Defect #35726

Time Formatting does not apply to CSV exports

Added by salman mp 2 months ago. Updated 2 months ago.

Status:ConfirmedStart date:
Priority:NormalDue date:
Assignee:-% Done:

0%

Category:-
Target version:-
Resolution: Affected version:3.4.0

Description

When you export time report to CSV, formatting does not apply on hours field.
Attached patch can fixed it.

timelog_helper.patch Magnifier (1.27 KB) salman mp, 2021-08-09 18:25

#35726.patch Magnifier - Patch against trunk @ r21131 (1.66 KB) Mischa The Evil, 2021-08-09 21:33


Related issues

Related to Redmine - Feature #23996: Introduce a setting to change the display format of times... Closed

History

#1 Updated by Mischa The Evil 2 months ago

  • File #35726.patchMagnifier added
  • Subject changed from Time Formatting does not apply in time reports export to Time Formatting does not apply to CSV exports
  • Category deleted (Time tracking)
  • Status changed from New to Confirmed
  • Affected version changed from 4.2.2 to 3.4.0
Nice catch! However, this does not only apply to the CSV export of the timelog report. It also applies to CSV exports of:
  • timelog details;
  • issue lists.
I'll leave a patch containing:
  • the OP's initial changes, in a correct format;
  • an additional change of QueriesHelper#csv_value to fix the issue for CSV exports of timelog details and issue lists.

I'll set the category to 'none' because it applies not only to 'Time tracking' and we don't have a CSV export category yet (and I don't want [to consider] to create it now).
I'll set the affected version to '3.4.0' because the issue was introduced with #23996. The fixes have to be back-ported to all supported Redmine branches.

I think that before this is being committed additional test coverage should be added for the fixed cases.

#2 Updated by Mischa The Evil 2 months ago

  • Related to Feature #23996: Introduce a setting to change the display format of timespans to HH:MM added

#3 Updated by Holger Just 2 months ago

I don't think we should backport this to older versions.

The CSV export emits a technical format which is usually consumed by spreadsheet software, or custom reporting tools. ere, it is important not to change the output format without consideration. As the output of the hours have always been floats here, consuming software likely expects this. Changing this in a patch update will likely break the assumptions of these tools unexpectedly.

As such, I believe we may ship this in 5.0.0 as a potentially breaking change and not backport it.

#4 Updated by Mischa The Evil 2 months ago

Good point. Fair enough. FYI, I'm also ok with no back-ports like you propose. My comment was more about the Redmine releases that are affected by this defect, and as such can be qualified as eligible for receiving the back-ports.

Nonetheless, I don't think that back-porting the fixes would become troublesome for the users in this case because:

Holger Just wrote:

[...] As the output of the hours have always been floats here, consuming software likely expects this. Changing this in a patch update will likely break the assumptions of these tools unexpectedly.

... this is not what these fixes would actually do IMHO. They don't change the output format of hours. Instead, slightly more subtle, they change the applicability of the setting that should determine the desired output format of the hours values.
Now, given that the default value of the setting is (still) to output floats (i.e. 'decimal'), nothing would change unless the administrator itself explicitly configured the Redmine instance to do so (i.e. by changing the setting to 'minutes'). And in that case it is/would be an anomaly to detect that only the CSV exports don't obey this setting (given that #23996 states: "a setting to also display such values in this way throughout the app"). And by then we can "argue" over whether "throughout the app" actually applies to CSV exports created by 'the app'... :lol: I'd say it does... :grin:

Also available in: Atom PDF