Project

General

Profile

Patch #14740 » RM_14740_display_hours_decimals_only_if_fractional_V2.diff

new patch - Jérôme BATAILLE, 2014-06-13 19:09

View differences:

i18n.rb (revision 1907)
def l_hours(hours)
hours = hours.to_f
l((hours < 2.0 ? :label_f_hour : :label_f_hour_plural), :value => ("%.2f" % hours.to_f))
# Specific : do not display decimals if zero
hours_rounded = hours.round(2)
hours_i = hours_rounded.to_i
if hours_rounded != hours_i
hours_s = ("%.2f" % hours.to_f)
else
hours_s = hours_i
end
# END -- Specific : do not display decimals if zero
l(((hours > -2.0 && hours < 2.0) ? :label_f_hour : :label_f_hour_plural), :value => hours_s)
end
def ll(lang, str, value=nil)
(3-3/4)