From dd1b2e8f6687bf3bc1c0db34921fc337e4910b09 Mon Sep 17 00:00:00 2001 From: Nathan Broadbent Date: Mon, 4 Jun 2012 17:57:23 +1200 Subject: [PATCH] Use nonzero? to chain sorting rules. --- app/controllers/apps_controller.rb | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/app/controllers/apps_controller.rb b/app/controllers/apps_controller.rb index 4bde84a..9ca4907 100644 --- a/app/controllers/apps_controller.rb +++ b/app/controllers/apps_controller.rb @@ -62,8 +62,9 @@ class AppsController < InheritedResources::Base # Sort apps by number of unresolved errs, then problem counts. apps.sort do |a,b| - unresolved = @unresolved_counts[b.id] <=> @unresolved_counts[a.id] - unresolved != 0 ? unresolved : @problem_counts[b.id] <=> @problem_counts[a.id] + (@unresolved_counts[b.id] <=> @unresolved_counts[a.id]).nonzero? || + (@problem_counts[b.id] <=> @problem_counts[a.id]).nonzero? || + a.name <=> b.name end end end -- libgit2 0.21.2