Commit dd1b2e8f6687bf3bc1c0db34921fc337e4910b09

Authored by Nathan Broadbent
1 parent fc1daf99
Exists in master and in 1 other branch production

Use nonzero? to chain sorting rules.

Showing 1 changed file with 3 additions and 2 deletions   Show diff stats
app/controllers/apps_controller.rb
@@ -62,8 +62,9 @@ class AppsController < InheritedResources::Base @@ -62,8 +62,9 @@ class AppsController < InheritedResources::Base
62 62
63 # Sort apps by number of unresolved errs, then problem counts. 63 # Sort apps by number of unresolved errs, then problem counts.
64 apps.sort do |a,b| 64 apps.sort do |a,b|
65 - unresolved = @unresolved_counts[b.id] <=> @unresolved_counts[a.id]  
66 - unresolved != 0 ? unresolved : @problem_counts[b.id] <=> @problem_counts[a.id] 65 + (@unresolved_counts[b.id] <=> @unresolved_counts[a.id]).nonzero? ||
  66 + (@problem_counts[b.id] <=> @problem_counts[a.id]).nonzero? ||
  67 + a.name <=> b.name
67 end 68 end
68 end 69 end
69 end 70 end