mirror of
https://github.com/edcommonwealth/Dashboard.git
synced 2026-03-17 01:45:53 -07:00
dirty commit: can't get references to work correctly between any tables
This commit is contained in:
parent
e1f0b78236
commit
a4fddbeced
183 changed files with 5461 additions and 5 deletions
38
app/presenters/dashboard/subcategory_card_presenter.rb
Normal file
38
app/presenters/dashboard/subcategory_card_presenter.rb
Normal file
|
|
@ -0,0 +1,38 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
module Dashboard
|
||||
class SubcategoryCardPresenter
|
||||
attr_reader :name, :subcategory, :category, :subcategory_id
|
||||
|
||||
def initialize(subcategory:, zones:, score:)
|
||||
@name = subcategory.name
|
||||
@subcategory = subcategory
|
||||
@category = subcategory.category
|
||||
@subcategory_id = subcategory.subcategory_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
|
||||
subcategory
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def zone
|
||||
@zones.zone_for_score(@score)
|
||||
end
|
||||
end
|
||||
end
|
||||
Loading…
Add table
Add a link
Reference in a new issue