From 9883381fce4f8e18b0a4d13b709c91a768d79052 Mon Sep 17 00:00:00 2001 From: Nathan Broadbent Date: Sat, 3 Sep 2011 17:56:02 +0800 Subject: [PATCH] Sort apps collection by number of unresolved errs (highest number first) --- app/controllers/apps_controller.rb | 5 +++++ 1 file changed, 5 insertions(+), 0 deletions(-) diff --git a/app/controllers/apps_controller.rb b/app/controllers/apps_controller.rb index 71e3a80..781606d 100644 --- a/app/controllers/apps_controller.rb +++ b/app/controllers/apps_controller.rb @@ -44,6 +44,11 @@ class AppsController < InheritedResources::Base end protected + def collection + # Sort apps by number of unresolved errs (highest number first) + @apps ||= App.all.sort{|a,b| b.errs.unresolved.count <=> a.errs.unresolved.count } + end + def initialize_subclassed_issue_tracker if params[:app][:issue_tracker_attributes] && tracker_type = params[:app][:issue_tracker_attributes][:type] if IssueTracker.subclasses.map(&:name).concat(["IssueTracker"]).include?(tracker_type) -- libgit2 0.21.2