Defect #11098

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

Added by Stanislav German-Evtushenko over 5 years ago. Updated over 5 years ago.

Status:ClosedStart date:
Priority:HighDue date:
Assignee:Jean-Philippe Lang% Done:

0%

Category:Issues
Target version:2.0.3
Resolution:Fixed Affected version:2.0.2

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.

enumeration.png (71.8 KB) Stanislav German-Evtushenko, 2012-06-06 10:45

production.sqlite3 (214 KB) Stanislav German-Evtushenko, 2012-06-06 21:19

enumerations.png (18.6 KB) Etienne Massip, 2012-06-08 01:03

Associated revisions

Revision 9781
Added by Jean-Philippe Lang over 5 years ago

Priorities have the same position and can't be reordered (#11098).

History

#1 Updated by Etienne Massip over 5 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.

#2 Updated by Stanislav German-Evtushenko over 5 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>
    

#3 Updated by Stanislav German-Evtushenko over 5 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
    

#4 Updated by Etienne Massip over 5 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?

#5 Updated by Etienne Massip over 5 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

#6 Updated by Stanislav German-Evtushenko over 5 years ago

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

#8 Updated by Etienne Massip over 5 years ago

Sorry, no clue.

Could you please post the database enumerations table contents?

#9 Updated by Stanislav German-Evtushenko over 5 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.

#10 Updated by Stanislav German-Evtushenko over 5 years ago

database example is attached

#11 Updated by Etienne Massip over 5 years ago

There is something wrong with your enumerations table contents:

Every IssuePriority except Low has a position of 2.

#12 Updated by Stanislav German-Evtushenko over 5 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?

#13 Updated by Stanislav German-Evtushenko over 5 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.

#14 Updated by Etienne Massip over 5 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.

#16 Updated by Etienne Massip over 5 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.

#17 Updated by Etienne Massip over 5 years ago

  • Target version changed from Candidate for next minor release to 2.0.3

Worth it (1.4.4?).

#18 Updated by Stanislav German-Evtushenko over 5 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.

#19 Updated by Jean-Philippe Lang over 5 years ago

It seems to affect 2.0.x only. Data loading works fine with 1.4.x for me.

#20 Updated by Etienne Massip over 5 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

#21 Updated by Jean-Philippe Lang over 5 years ago

  • Subject changed from priority-N for CSS doesn't work to Default priorities have the same position and can't be reordered

#22 Updated by Jean-Philippe Lang over 5 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).

#23 Updated by Jean-Philippe Lang over 5 years ago

  • Status changed from Resolved to Closed

Merged.

Also available in: Atom PDF