プロジェクト

全般

プロフィール

Vote #71981

完了

Default priorities have the same position and can't be reordered

Admin Redmine さんが約4年前に追加. 約4年前に更新.

ステータス:
Closed
優先度:
高め
担当者:
-
カテゴリ:
Issues_2
対象バージョン:
開始日:
2022/05/09
期日:
進捗率:

0%

予定工数:
category_id:
2
version_id:
52
issue_org_id:
11098
author_id:
1381
assigned_to_id:
1
comments:
23
status_id:
5
tracker_id:
1
plus1:
0
affected_version:
closed_on:
affected_version_id:
50
ステータス-->[Closed]

説明

CSS class "priority-N" doesn't depend on an issue priority anymore and it is always "priority-2". As a result - alnernate theme priority colours don't work.

It worked well in 1.4-stable.


journals

Works fine on trunk and I don't think there has been some fix committed related to this issue.
--------------------------------------------------------------------------------
* please have a look: http://redmine.ourproject.org/projects/kune/issues <pre>

<tr id="issue-284" class="hascontextmenu odd issue status-1 priority-2">
<td class="checkbox hide-when-print"><input name="ids[]" value="284" type="checkbox"></td>
<td class="id"><a href="/issues/284">284</a></td>
<td class="tracker">Bug</td><td class="status">New</td><td class="priority">High</td><td class="subject"><a href="/issues/284">Add time in errors</a></td><td class="assigned_to"><a href="/users/4">Vicente J. Ruiz Jurado</a></td><td class="updated_on">06/05/2012 03:07 am</td>
</tr>
<tr id="issue-283" class="hascontextmenu even issue status-1 priority-2">
<td class="checkbox hide-when-print"><input name="ids[]" value="283" type="checkbox"></td>
<td class="id"><a href="/issues/283">283</a></td>
<td class="tracker">Bug</td><td class="status">New</td><td class="priority">High</td><td class="subject"><a href="/issues/283">Create custom "More" menu in Kune</a></td><td class="assigned_to"><a href="/users/4">Vicente J. Ruiz Jurado</a></td><td class="updated_on">06/05/2012 02:05 am</td>
</tr>
<tr id="issue-282" class="hascontextmenu odd issue status-1 priority-2">
<td class="checkbox hide-when-print"><input name="ids[]" value="282" type="checkbox"></td>
<td class="id"><a href="/issues/282">282</a></td>
<td class="tracker">Bug</td><td class="status">New</td><td class="priority">Normal</td><td class="subject"><a href="/issues/282">The unread notification in the header does not get updated automatically sometimes</a></td><td class="assigned_to"><a href="/users/4">Vicente J. Ruiz Jurado</a></td><td class="updated_on">06/04/2012 12:08 am</td>
</tr>
<tr id="issue-281" class="hascontextmenu even issue status-1 priority-2">
<td class="checkbox hide-when-print"><input name="ids[]" value="281" type="checkbox"></td>
<td class="id"><a href="/issues/281">281</a></td>
<td class="tracker">Bug</td><td class="status">New</td><td class="priority">High</td><td class="subject"><a href="/issues/281">Cannot load waves, frequently (video)</a></td><td class="assigned_to"><a href="/users/4">Vicente J. Ruiz Jurado</a></td><td class="updated_on">06/02/2012 07:21 pm</td>
</tr>
</pre>
--------------------------------------------------------------------------------
* From Administration -> Information page: <pre>
Information

Redmine 2.0.2.stable.9774
Default administrator account changed True
Attachments directory writable True
Plugin assets directory writable True
RMagick available (optional) True

Environment:
Redmine version 2.0.2.stable.9774
Ruby version 1.9.3 (i686-linux)
Rails version 3.2.5
Environment production
Database adapter SQLite
Redmine plugins:
no plugin installed
</pre>
--------------------------------------------------------------------------------
Indeed.

Did you make some manual changes to @Issue#css_classes@ (source:/tags/2.0.2/app/models/issue.rb#L682)?

What's your @enumerations@ table contents looks like?
--------------------------------------------------------------------------------

--------------------------------------------------------------------------------
Nothing were changed at all. Enumerations also were not changed. Screenshot is attached.
--------------------------------------------------------------------------------

--------------------------------------------------------------------------------
Sorry, no clue.

Could you please post the database @enumerations@ table contents?

--------------------------------------------------------------------------------
Sorry, I don't have an access to the database currently but I made the same test with a clean database that was just migrated and data default was loaded - same result.
--------------------------------------------------------------------------------
database example is attached
--------------------------------------------------------------------------------
There is something wrong with your @enumerations@ table contents:

!enumerations.png!

Every @IssuePriority@ except ??Low?? has a position of 2.
--------------------------------------------------------------------------------
Etienne Massip wrote:
> There is something wrong with your @enumerations@ table contents:
>
> !enumerations.png!
>
> Every @IssuePriority@ except ??Low?? has a position of 2.

That clear database just migrated and English default data loaded. Can it be database migation or sqlite3 problem?
So, as a workaround I can try fix database manually, right?
--------------------------------------------------------------------------------
I have just tried to change position using admin interface - doesn't work. I'm not sure why but only 1 and 2 are possible. If I click "Move down" again it does nothing.
--------------------------------------------------------------------------------
You're just right, just reproduced it very easily with a simple @db:migrate@ @redmine:load_default_data@ sequence.
--------------------------------------------------------------------------------
Looks like the @default_scope@ defined in source:/tags/2.0.2/app/models/enumeration.rb#L21 overrides the condition in source:/tags/2.0.2/lib/plugins/acts_as_list/lib/active_record/acts/list.rb#L212.

--------------------------------------------------------------------------------
There's an "open Rails issue":https://github.com/rails/rails/pull/2008 about this behavior.

What I don't get is that it used to work but still I can reproduce even with 1.4 branch???

Here's a simple patch to fix it:

<pre><code class="diff">
Index: lib/plugins/acts_as_list/lib/active_record/acts/list.rb
===================================================================
--- lib/plugins/acts_as_list/lib/active_record/acts/list.rb (revision 9776)
+++ lib/plugins/acts_as_list/lib/active_record/acts/list.rb (working copy)
@@ -209,7 +209,7 @@
def bottom_item(except = nil)
conditions = scope_condition
conditions = "#{conditions} AND #{self.class.primary_key} != #{except.id}" if except
- acts_as_list_class.find(:first, :conditions => conditions, :order => "#{position_column} DESC")
+ acts_as_list_class.where(conditions).reorder("#{position_column} DESC").first
end

# Forces item to assume the bottom position in the list.
</code></pre>

Last thought: specifying the value of the @position@ field in loader is useless since it will be set by @acts_as_list@ in the end.

--------------------------------------------------------------------------------
Worth it (1.4.4?).
--------------------------------------------------------------------------------
Etienne, same for me. When I first installed Redmine 1.4.1 (and we've been still using it) there was no such problem. Then we upgraded to 1.4.2 and it still works well.
--------------------------------------------------------------------------------
It seems to affect 2.0.x only. Data loading works fine with 1.4.x for me.
--------------------------------------------------------------------------------
Jean-Philippe Lang wrote:
> It seems to affect 2.0.x only. Data loading works fine with 1.4.x for me.

I ran the @IssuePriority.create!@ in rails console and saw that the statement was the same as in 2.x with the two sorting specifications in the same wrong order.

Maybe is there some final override if you specify the :position column value in Rails 2.3.

Or, more probably, I missed something.

Edit: I confirm it worked on 1.4
--------------------------------------------------------------------------------

--------------------------------------------------------------------------------
Fixed in r9781. Priorities are now created correctly. For existing priorities with the same position, you can now reorder them properly (they will be automatically fixed and updated to sequential numbers the first time you move one priority in the list).
--------------------------------------------------------------------------------
Merged.
--------------------------------------------------------------------------------

Admin Redmine さんが約4年前に更新

  • カテゴリIssues_2 にセット
  • 対象バージョン2.0.3_52 にセット

他の形式にエクスポート: Atom PDF

いいね!0
いいね!0