Try changing the named_scope in /app/models/todo.rb for active_or_hidden. I 
believe this scope overrides your :order

 

Reinier

 

Van: [email protected] 
[mailto:[email protected]] Namens Werner Fouché
Verzonden: zaterdag 17 maart 2012 19:02
Aan: [email protected]
Onderwerp: [Tracks-discuss] Tracks 2.0 vs Track 1.7.2 on Windows.

 

Hi,

 

I’m using the Bitnami distribution of Tracks on two different computers. The 
first is running Tracks 1.7.2 and the second Tracks 2.0. Uncompleted actions in 
a project in Tracks 1.7.2 are sorted in ascending order. In Tracks 2.0 
uncompleted actions in a project are not sorted at all and appear in the order 
in which they were entered.

 

Line 45 to 69 of file projects_controller.rb in Tracks 2.0 is listed below. I 
think the definition of @not_done needs to change to get Tracks 2.0 to behave 
the same as Tracks 1.7.2, but I do not know how to change it. Any help will be 
appreciated.

 

def show

    @max_completed = current_user.prefs.show_number_completed

    init_data_for_sidebar unless mobile?

    @page_title = t('projects.page_title', :project => @project.name)

    

    @not_done = @project.todos.active_or_hidden(:include => [:tags, :context, 
:predecessors])

    @deferred = @project.deferred_todos(:include => [:tags, :context, 
:predecessors])

    @pending = @project.pending_todos(:include => [:tags, :context, 
:predecessors])

    @done = @project.todos.find_in_state(:all, :completed,

      :order => "todos.completed_at DESC", :limit => 
current_user.prefs.show_number_completed, :include => [:context, :tags, 
:predecessors])

 

    @count = @not_done.size

    @down_count = @count + @deferred.size + @pending.size

    @next_project = current_user.projects.next_from(@project)

    @previous_project = current_user.projects.previous_from(@project)

    @default_tags = @project.default_tags

    @new_note = current_user.notes.new

    @new_note.project_id = @project.id

    @contexts = current_user.contexts

    respond_to do |format|

      format.html

      format.m     &render_project_mobile

      format.xml   { render :xml => @project.to_xml( :except => :user_id )  }

    end

  end

I’ve tried changing @not_done to 

 

    @not_done = @project.todos.active_or_hidden(:order => "todos.due ASC", 
:include => [:tags, :context, :predecessors])

 

but this was not successful. The sort order did not change – the actions remain 
unsorted.

 

Thanks,

 

Werner

_______________________________________________
Tracks-discuss mailing list
[email protected]
http://lists.rousette.org.uk/mailman/listinfo/tracks-discuss

Reply via email to