mirror of
https://github.com/edcommonwealth/sqm-dashboards.git
synced 2026-03-08 23:18:18 -07:00
Upgrade to rails 5.2. Catch null state in percentage_for method
This commit is contained in:
parent
6320d5633f
commit
68357e65ec
3 changed files with 48 additions and 48 deletions
|
|
@ -27,8 +27,10 @@ class GaugePresenter
|
|||
end
|
||||
|
||||
def percentage_for(number)
|
||||
number ||= 0
|
||||
scale_minimum = @scale.warning_zone.low_benchmark
|
||||
scale_maximum = @scale.ideal_zone.high_benchmark
|
||||
|
||||
(number - scale_minimum) / (scale_maximum - scale_minimum)
|
||||
end
|
||||
end
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue