Patch #10970

Sort issues in roadmap by IssueStatus.position

Added by Александр Гурьянов over 10 years ago. Updated over 3 years ago.

Status:NewStart date:
Priority:NormalDue date:
Assignee:-% Done:

0%

Category:Roadmap
Target version:-

Description

Sort issues in the roadmap by their statuses. With this patch you can move open issues to top and closed to bottom of the list according their statuses.

Related to feature request: http://www.redmine.org/issues/10969

roadmap_issues_sort.diff Magnifier (1.21 KB) Александр Гурьянов, 2012-05-19 13:54


Related issues

Related to Redmine - Feature #10969: Sort issue in roadmap by status New

History

#1 Updated by Александр Гурьянов over 10 years ago

Revision: trunk(9701)

#2 Updated by Sunding Wei over 3 years ago

Thanks for the patch, I fixed for Redmine v3.4.4

Hope this feature can be merged into redmine master.

--- versions_controller.rb.old    2019-03-06 13:43:41.068549228 +0800
+++ versions_controller.rb    2019-03-06 14:32:04.942060762 +0800
@@ -49,10 +49,10 @@
         @issues_by_version = {}
         if @selected_tracker_ids.any? && @versions.any?
           issues = Issue.visible.
-            includes(:project, :tracker).
+            includes(:project, :tracker, :status).
             preload(:status, :priority, :fixed_version).
             where(:tracker_id => @selected_tracker_ids, :project_id => project_ids, :fixed_version_id => @versions.map(&:id)).
-            order("#{Project.table_name}.lft, #{Tracker.table_name}.position, #{Issue.table_name}.id")
+            order("#{Project.table_name}.lft, #{Tracker.table_name}.position, #{IssueStatus.table_name}.position,  #{Issue.table_name}.id")
           @issues_by_version = issues.group_by(&:fixed_version)
         end
         @versions.reject! {|version| !project_ids.include?(version.project_id) && @issues_by_version[version].blank?}
@@ -69,7 +69,7 @@
         @issues = @version.fixed_issues.visible.
           includes(:status, :tracker, :priority).
           preload(:project).
-          reorder("#{Tracker.table_name}.position, #{Issue.table_name}.id").
+          reorder("#{Tracker.table_name}.position, #{IssueStatus.table_name}.position, #{Issue.table_name}.id").
           to_a
       }
       format.api

Also available in: Atom PDF