mirror of
https://github.com/edcommonwealth/sqm-dashboards.git
synced 2026-03-07 21:48:16 -08:00
we have a gauge! next up, let's style the page
This commit is contained in:
parent
5d6c1000f4
commit
25578a896f
29 changed files with 614 additions and 112 deletions
|
|
@ -1,44 +1,6 @@
|
|||
class Measure < ActiveRecord::Base
|
||||
belongs_to :subcategory
|
||||
has_many :survey_items
|
||||
|
||||
Zone = Struct.new(:low_benchmark, :high_benchmark, :type) do
|
||||
def includes_score?(score)
|
||||
score > low_benchmark and score < high_benchmark
|
||||
end
|
||||
end
|
||||
|
||||
def warning_zone
|
||||
Zone.new(1, watch_low_benchmark, :warning)
|
||||
end
|
||||
|
||||
def watch_zone
|
||||
Zone.new(watch_low_benchmark, growth_low_benchmark, :watch)
|
||||
end
|
||||
|
||||
def growth_zone
|
||||
Zone.new(growth_low_benchmark, approval_low_benchmark, :growth)
|
||||
end
|
||||
|
||||
def approval_zone
|
||||
Zone.new(approval_low_benchmark, ideal_low_benchmark, :approval)
|
||||
end
|
||||
|
||||
def ideal_zone
|
||||
Zone.new(ideal_low_benchmark, 5.0, :ideal)
|
||||
end
|
||||
|
||||
def zone_for_score(score)
|
||||
case score
|
||||
when ideal_zone.low_benchmark..ideal_zone.high_benchmark
|
||||
ideal_zone
|
||||
when approval_zone.low_benchmark..approval_zone.high_benchmark
|
||||
approval_zone
|
||||
when growth_zone.low_benchmark..growth_zone.high_benchmark
|
||||
growth_zone
|
||||
when watch_zone.low_benchmark..watch_zone.high_benchmark
|
||||
watch_zone
|
||||
else
|
||||
warning_zone
|
||||
end
|
||||
end
|
||||
has_many :survey_item_responses, through: :survey_items
|
||||
end
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue