Commit fc1daf997808942d64a22ee048d2712dae9e41eb

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

Fixed sorting for Apps index table

app/controllers/apps_controller.rb
@@ -61,12 +61,10 @@ class AppsController < InheritedResources::Base @@ -61,12 +61,10 @@ class AppsController < InheritedResources::Base
61 end 61 end
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] 65 unresolved = @unresolved_counts[b.id] <=> @unresolved_counts[a.id]
66 unresolved != 0 ? unresolved : @problem_counts[b.id] <=> @problem_counts[a.id] 66 unresolved != 0 ? unresolved : @problem_counts[b.id] <=> @problem_counts[a.id]
67 end 67 end
68 -  
69 - apps  
70 end 68 end
71 end 69 end
72 70
app/views/apps/index.html.haml
@@ -36,7 +36,7 @@ @@ -36,7 +36,7 @@
36 = link_to( app.last_deploy_at.to_s(:micro) << (revision.present? ? " (#{revision})" : ""), app_deploys_path(app)) 36 = link_to( app.last_deploy_at.to_s(:micro) << (revision.present? ? " (#{revision})" : ""), app_deploys_path(app))
37 %td.count 37 %td.count
38 - if @problem_counts[app.id] > 0 38 - if @problem_counts[app.id] > 0
39 - - unresolved = @unresolved_counts[app.id] || app.problems.unresolved.count 39 + - unresolved = @unresolved_counts[app.id]
40 = link_to unresolved, app_path(app), :class => (unresolved == 0 ? "resolved" : nil) 40 = link_to unresolved, app_path(app), :class => (unresolved == 0 ? "resolved" : nil)
41 - if @apps.none? 41 - if @apps.none?
42 %tr 42 %tr