mirror of
https://github.com/edcommonwealth/sqm-dashboards.git
synced 2026-03-08 23:18:18 -07:00
Sort measures by the highest score to lowest score [finishes #179726949]
This commit is contained in:
parent
d7ead5bac9
commit
87f268dd7a
4 changed files with 35 additions and 0 deletions
|
|
@ -4,6 +4,7 @@ class DashboardController < ApplicationController
|
|||
@measure_graph_row_presenters = measure_ids
|
||||
.map { |measure_id| Measure.find_by_measure_id measure_id }
|
||||
.map(&method(:presenter_for_measure))
|
||||
.sort().reverse
|
||||
end
|
||||
|
||||
private
|
||||
|
|
|
|||
|
|
@ -1,4 +1,5 @@
|
|||
class MeasureGraphRowPresenter
|
||||
include Comparable
|
||||
def initialize(measure:, score:)
|
||||
@measure = measure
|
||||
@score = score
|
||||
|
|
@ -29,6 +30,14 @@ class MeasureGraphRowPresenter
|
|||
end
|
||||
end
|
||||
|
||||
def <=>(other_presenter)
|
||||
if x_offset.to_f == other_presenter.x_offset.to_f
|
||||
return bar_width.to_f <=> other_presenter.bar_width.to_f
|
||||
end
|
||||
|
||||
x_offset.to_f <=> other_presenter.x_offset.to_f
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
IDEAL_ZONE_WIDTH_PERCENTAGE = 0.5 / 2
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue