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.
36 lines
554 B
36 lines
554 B
# frozen_string_literal: true
|
|
|
|
class Overview::ScorecardPresenter
|
|
attr_reader :name, :construct, :category, :id
|
|
|
|
def initialize(construct:, zones:, score:, id:)
|
|
@name = construct.name
|
|
@category = construct.category
|
|
@id = id
|
|
@zones = zones
|
|
@score = score
|
|
end
|
|
|
|
def harvey_ball_icon
|
|
"#{zone.type}-harvey-ball"
|
|
end
|
|
|
|
def color
|
|
zone.type.to_s
|
|
end
|
|
|
|
def insufficient_data?
|
|
zone.type == :insufficient_data
|
|
end
|
|
|
|
def to_model
|
|
construct
|
|
end
|
|
|
|
private
|
|
|
|
def zone
|
|
@zones.zone_for_score(@score)
|
|
end
|
|
end
|