sqm-dashboards/app/presenters/subcategory_card_presenter.rb

22 lines
378 B
Ruby

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