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.
46 lines
733 B
46 lines
733 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 svg
|
|
|
|
end
|
|
|
|
def offset
|
|
return 40 unless abbreviation.length > 1
|
|
27
|
|
end
|
|
|
|
def color
|
|
case zone.type
|
|
when :warning
|
|
return "fill-warning"
|
|
when :watch
|
|
return "fill-watch"
|
|
when :growth
|
|
return "fill-growth"
|
|
when :approval
|
|
return "fill-approval"
|
|
when :ideal
|
|
return "fill-ideal"
|
|
else
|
|
return "fill-warning"
|
|
end
|
|
|
|
end
|
|
|
|
private
|
|
|
|
def zone
|
|
@scale.zone_for_score(@score)
|
|
end
|
|
end
|