Defect #11098
closedDefault priorities have the same position and can't be reordered
0%
Description
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.
Files
Updated by Etienne Massip over 12 years ago
- Resolution set to Cant reproduce
Works fine on trunk and I don't think there has been some fix committed related to this issue.
Updated by Stanislav German-Evtushenko over 12 years ago
- please have a look: http://redmine.ourproject.org/projects/kune/issues
<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>
Updated by Stanislav German-Evtushenko over 12 years ago
- From Administration -> Information page:
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
Updated by Etienne Massip over 12 years ago
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?
Updated by Etienne Massip over 12 years ago
- Affected version (unused) changed from 2.0.1 to 2.0.2
- Affected version changed from 2.0.1 to 2.0.2
Updated by Stanislav German-Evtushenko over 12 years ago
Nothing were changed at all. Enumerations also were not changed. Screenshot is attached.
Updated by Stanislav German-Evtushenko over 12 years ago
- File enumeration.png enumeration.png added
Updated by Etienne Massip over 12 years ago
Sorry, no clue.
Could you please post the database enumerations
table contents?
Updated by Stanislav German-Evtushenko over 12 years ago
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.
Updated by Stanislav German-Evtushenko over 12 years ago
- File production.sqlite3 production.sqlite3 added
database example is attached
Updated by Etienne Massip over 12 years ago
- File enumerations.png enumerations.png added
There is something wrong with your enumerations
table contents:
Every IssuePriority
except Low has a position of 2.
Updated by Stanislav German-Evtushenko over 12 years ago
Etienne Massip wrote:
There is something wrong with your
enumerations
table contents: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?
Updated by Stanislav German-Evtushenko over 12 years ago
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.
Updated by Etienne Massip over 12 years ago
- Status changed from New to Confirmed
- Priority changed from Normal to High
- Target version set to Candidate for next minor release
- Resolution deleted (
Cant reproduce)
You're just right, just reproduced it very easily with a simple db:migrate
redmine:load_default_data
sequence.
Updated by Etienne Massip over 12 years ago
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.
Updated by Etienne Massip over 12 years ago
There's an open Rails issue 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:
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.
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.
Updated by Etienne Massip over 12 years ago
- Target version changed from Candidate for next minor release to 2.0.3
Worth it (1.4.4?).
Updated by Stanislav German-Evtushenko over 12 years ago
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.
Updated by Jean-Philippe Lang over 12 years ago
It seems to affect 2.0.x only. Data loading works fine with 1.4.x for me.
Updated by Etienne Massip over 12 years ago
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
Updated by Jean-Philippe Lang over 12 years ago
- Subject changed from priority-N for CSS doesn't work to Default priorities have the same position and can't be reordered
Updated by Jean-Philippe Lang over 12 years ago
- Status changed from Confirmed to Resolved
- Assignee set to Jean-Philippe Lang
- Resolution set to Fixed
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).