Sort measures by the highest score to lowest score [finishes #179726949]

This commit is contained in:
Chad Serrant 2021-09-29 09:43:26 -04:00
parent d7ead5bac9
commit 87f268dd7a
4 changed files with 35 additions and 0 deletions

View file

@ -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