Commit dd1b2e8f6687bf3bc1c0db34921fc337e4910b09
1 parent
fc1daf99
Exists in
master
and in
1 other branch
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 | 62 | |
63 | 63 | # Sort apps by number of unresolved errs, then problem counts. |
64 | 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 | 68 | end |
68 | 69 | end |
69 | 70 | end | ... | ... |