You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
sqm-dashboards/app/presenters/subcategory_card_presenter.rb

23 lines
378 B

class SubcategoryCardPresenter
def initialize(scale:, score:)
@scale = scale
@score = score
end
def abbreviation
abbreviations = { approval: "A", ideal: "I", growth: "G", watch: "Wa", warning: "Wr", no_zone: "N" }
abbreviations[zone.type]
end
def color
"bg-#{zone.type}"
end
private
def zone
@scale.zone_for_score(@score)
end
end