From 8da72cb712dce17d6537cf71ab90b6d1959e37a1 Mon Sep 17 00:00:00 2001 From: Go MAEDA Date: Sat, 31 Aug 2024 09:26:50 +0000 Subject: Fix precision issues in TimeEntry#hours calculation by returning Rational instead of Float (#40914). Patch by Go MAEDA (user:maeda). git-svn-id: https://svn.redmine.org/redmine/trunk@23000 e93f8b46-1217-0410-a6f0-8f06a7374b81 --- lib/redmine/i18n.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'lib') diff --git a/lib/redmine/i18n.rb b/lib/redmine/i18n.rb index 0488fa289..a9cd1dd0d 100644 --- a/lib/redmine/i18n.rb +++ b/lib/redmine/i18n.rb @@ -50,12 +50,12 @@ module Redmine end def l_hours(hours) - hours = hours.to_f + hours = hours.to_f unless hours.is_a?(Numeric) l((hours < 2.0 ? :label_f_hour : :label_f_hour_plural), :value => format_hours(hours)) end def l_hours_short(hours) - l(:label_f_hour_short, :value => format_hours(hours.to_f)) + l(:label_f_hour_short, :value => format_hours(hours.is_a?(Numeric) ? hours : hours.to_f)) end def ll(lang, str, arg=nil) -- cgit v1.2.3