1
0

Displaying errors for uncomputable formulas in nutrients view

This commit is contained in:
cryptogopher
2020-03-21 00:38:39 +01:00
parent 9a79e8fa55
commit c3b783e942
5 changed files with 22 additions and 7 deletions

View File

@@ -1,6 +1,13 @@
module BodyTrackersHelper
def format_value(value)
amount, unitname = value
amount.nil? ? '-' : "#{amount} [#{unitname || '-'}]"
case
when amount.nil?
'-'
when amount.nan?
'?'
else
"#{amount} [#{unitname || '-'}]"
end
end
end