Project

General

Profile

Increase decimal digits in customised fields

Added by canal 357 almost 3 years ago

Hello, does anybody know how to increase the decimal digits of a customised field that appears when showing the issue information. Now it shows only two decimal digits.
Thanks in advance.


Replies (3)

RE: Increase decimal digits in customised fields - Added by Lorenzo Meneghetti almost 3 years ago

Hi, please add some details. Format type of cf? admin/info page? Format type cf provided from a plugin? Redmine core has no decimal cf format type.
I have deep knowledge only in Redmine versions < 4.
thanks
Lorenzo

RE: Increase decimal digits in customised fields - Added by canal 357 almost 3 years ago

Hi, format type in custom field is float. I can set a cf with a decimal value with two or more digits but when you see de issue information there are only two decimal digits. When editing the issue the custom field appears with the original decimal digits.

Thanks.

RE: Increase decimal digits in customised fields - Added by Lorenzo Meneghetti almost 3 years ago

Hi, I see, sorry never used float field format. Anyway just checked. No customization is provided and rounding to 2 digit is hard-coded.
But it's easy to patch. I will not provide you a patch file, i will tell you where to edit. Try in a sandbox environment if you are not a developer or ask a developer.

Find in .../app/helpers/application_helper.rb lines in method format_object

    when 'Float'
      sprintf "%.2f", object

and change to

    when 'Float'
      sprintf "%.4f", object

to have, for example, 4 digits.
Thanks
Lorenzo

    (1-3/3)