Added rounding and not displaying 0
This commit is contained in:
parent
3418af87c1
commit
9f3f90e4f0
@ -7,8 +7,10 @@ module BodyTrackersHelper
|
|||||||
when amount.nan?
|
when amount.nan?
|
||||||
'?'
|
'?'
|
||||||
else
|
else
|
||||||
unit_desc = unit != mfu_unit ? unit && " [#{unit.shortname}]" || ' [-]' : ''
|
a = amount.round(precision)
|
||||||
"%.#{precision}f%s" % [amount, unit_desc]
|
a_desc = a.nonzero? ? "%.#{precision}f" % a : '-'
|
||||||
|
u_desc = unit && " [#{unit.shortname}]" || ' [-]' if unit != mfu_unit && a.nonzero?
|
||||||
|
"#{a_desc}#{u_desc}"
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user