Project

General

Profile

Actions

Patch #14740

open

display decimals hours only if fractional

Added by Jérôme BATAILLE about 11 years ago. Updated almost 10 years ago.

Status:
New
Priority:
Normal
Assignee:
-
Category:
Time tracking
Target version:
-
Start date:
Due date:
% Done:

0%

Estimated time:

Description

4 hours could be displayed 4 hours
4.5 hours will still be displayed 4.50 hours


Files

Actions #2

Updated by Daniel Felix about 11 years ago

Hi Jérôme,

what do you think about a shorter notation for this. This would improve the read through. But well, maybe just my opinion. :-)

Maybe this thing could be enhanced to solve the sometimes requested format like 4h 30m instead of 4.5h.

Actions #3

Updated by Jérôme BATAILLE about 11 years ago

what do you think about a shorter notation for this. This would improve the read through. But well, maybe just my opinion. :-)

Your code enhancement is quite OK for me !

Maybe this thing could be enhanced to solve the sometimes requested format like 4h 30m instead of 4.5h.

Could it have side effects ?
For example, I know that sometimes, we copy samples of data directly from the html page and insert it in an excel file to make sorts and filters. More human readable formats like you propose can be more user friendly, but perhaps it can disturb such operations.
I don't know if in recent Redmine versions, there are still cases where exports miss some informations, that we can get by copying html.

Besides, perhaps the hours display format can be configurable in the user profile, to give the possibility to manage any use case ?

Actions #4

Updated by Jérôme BATAILLE over 10 years ago

Hi Daniel,

In the enhancement you provided there is a little glitch because, you compare 2.0 with hours casted as a string.

Is there is a chance that this patch is integrated to the core ?

Actions #5

Updated by Toshi MARUYAMA over 10 years ago

Jérôme BATAILLE wrote:

Is there is a chance that this patch is integrated to the core ?

Please add tests.
source:trunk/test/unit/lib/redmine/i18n_test.rb

Actions #6

Updated by Jérôme BATAILLE over 10 years ago

Here is a new version that fixes the following case :
Input 5.001
=> 5.00 hours was displayed.

Now it displays 5 hours because hours are rounded to 2 decimals.

The second patch adds comprehensive tests.

To test them alone :
ruby -I"lib:test" test/unit/lib/redmine/i18n_test.rb -n test_localize_hours_truncate_decimals_if_integer
ruby -I"lib:test" test/unit/lib/redmine/i18n_test.rb -n test_localize_negative_hours

Actions #7

Updated by Jérôme BATAILLE almost 10 years ago

Now that we have provided a patch for the tests, any chance that this patch is integrated to the core ?

Actions

Also available in: Atom PDF