Bug 132582 - SUM (in status bar) produces different result depending on first value (and selection direction), when counting times
Summary: SUM (in status bar) produces different result depending on first value (and s...
Status: VERIFIED FIXED
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Calc (show other bugs)
Version:
(earliest affected)
unspecified
Hardware: All All
: medium normal
Assignee: Eike Rathke
URL:
Whiteboard: target:7.4.0 target:7.3.4
Keywords:
Depends on:
Blocks:
 
Reported: 2020-05-01 10:47 UTC by Cor Nouws
Modified: 2022-05-16 09:45 UTC (History)
5 users (show)

See Also:
Crash report or crash signature:


Attachments
test document with explanation (11.41 KB, application/vnd.oasis.opendocument.spreadsheet)
2020-05-01 10:52 UTC, Cor Nouws
Details
two screen shots (50.83 KB, image/png)
2020-05-01 10:52 UTC, Cor Nouws
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Cor Nouws 2020-05-01 10:47:03 UTC
Will attach a spreadsheet

There are some ranges with times (HH:MM:SS)

1 – Select from D6 to D2 (bottom to top)
  > notice that the sum restarts counting at 24

2 – Select from H5 to H2 (bottom to top)
  > notice that the sum continues to count above 24

Interesting :)

= = = Note! 
I thought this could be related to the fact that counting columns of time cells with SUM() sometimes restarts at 24, and sometimes just totals..
I've seen this effect for over 10 year now, but never fiddled out what made the difference.
Alas I see no way how the now reported bug, influences that..
= = =
Comment 1 Cor Nouws 2020-05-01 10:52:04 UTC
Created attachment 160178 [details]
test document with explanation
Comment 2 Cor Nouws 2020-05-01 10:52:25 UTC
Created attachment 160179 [details]
two screen shots
Comment 3 Cor Nouws 2020-05-01 10:53:24 UTC
this is somehow related to bug 57840

However I think the situation is more specified and indeed represents unexpected behavior
Comment 4 m_a_riosv 2020-05-01 13:32:02 UTC
Confirmed
Version: 7.0.0.0.alpha0+ (x64)
Build ID: 7459b9ecb54a298f02d19089620149718f8d8d48
CPU threads: 4; OS: Windows 10.0 Build 19608; UI render: Skia/Raster; VCL: win; 
Locale: es-ES (es_ES); UI-Language: en-US Calc: CL
Comment 5 QA Administrators 2022-05-02 03:36:56 UTC Comment hidden (obsolete)
Comment 6 Cor Nouws 2022-05-10 08:04:35 UTC
still an issue in Version: 7.4.0.0.alpha0+ / LibreOffice Community
Build ID: 69f412459257398a7d779541dad95aa7227a5e74
CPU threads: 8; OS: Linux 5.4; UI render: default; VCL: gtk3
Locale: nl-NL (en_US.UTF-8); UI: nl-NL
Calc: threaded

@Eike - could be an interesting one :) ?
Comment 7 Eike Rathke 2022-05-10 09:22:05 UTC
It depends on the format of the currently active cell, which is used to display the result. D2, D6 and F2 (and D8,F8) have HH:MM:SS format, others have [HH]:MM:SS format.
For time we maybe could detect >=24 hours and then always use [HH]:MM:SS
Comment 8 Cor Nouws 2022-05-10 10:23:36 UTC
(In reply to Eike Rathke from comment #7)
> It depends on the format of the currently active cell, which is used to
> display the result. D2, D6 and F2 (and D8,F8) have HH:MM:SS format, others
> have [HH]:MM:SS format.

So simple :)

> For time we maybe could detect >=24 hours and then always use [HH]:MM:SS

Sounds good.
I'll dive into this, since I think to remember that counting times >=24 hours in a sheet is not always predictable too, while keeping the formatting of the cells in mind..
Comment 9 Commit Notification 2022-05-10 22:26:20 UTC
Eike Rathke committed a patch related to this issue.
It has been pushed to "master":

https://git.libreoffice.org/core/commit/23689e492feb41a391738586cef04ab82cc21f80

Resolves: tdf#132582 Display duration for calculated time values selection

It will be available in 7.4.0.

The patch should be included in the daily builds available at
https://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
https://wiki.documentfoundation.org/Testing_Daily_Builds

Affected users are encouraged to test the fix and report feedback.
Comment 10 Eike Rathke 2022-05-10 23:08:35 UTC
Pending review https://gerrit.libreoffice.org/c/core/+/134069 for 7-3
Comment 11 Commit Notification 2022-05-11 07:58:45 UTC
Eike Rathke committed a patch related to this issue.
It has been pushed to "libreoffice-7-3":

https://git.libreoffice.org/core/commit/8b6ce0459302580a616c657f6aff19e41660dcdf

Resolves: tdf#132582 Display duration for calculated time values selection

It will be available in 7.3.4.

The patch should be included in the daily builds available at
https://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
https://wiki.documentfoundation.org/Testing_Daily_Builds

Affected users are encouraged to test the fix and report feedback.
Comment 12 Cor Nouws 2022-05-16 09:02:33 UTC
Verified in Version: 7.4.0.0.alpha1+ / LibreOffice Community
Build ID: fc2716740bd513154ae4ab5404d9c575678172e0
CPU threads: 8; OS: Linux 5.4; UI render: default; VCL: gtk3
Locale: nl-NL (en_US.UTF-8); UI: nl-NL
Calc: threaded

Status bar now shows sum in total hours
thanks Eike!


(In reply to Cor Nouws from comment #8)
> I'll dive into this, since I think to remember that counting times >=24
> hours in a sheet is not always predictable too, while keeping the formatting
> of the cells in mind..

Found an older example. With the SUM formula and a sum > 24 hours.
With formatting code UU:MM that still restarts counting at every 24.
With formatting code [UU]:MM it shows the number => 24.

Is that expected?
Comment 13 Cor Nouws 2022-05-16 09:03:10 UTC
(In reply to Cor Nouws from comment #12)

> Found an older example. With the SUM formula and a sum > 24 hours.
> With formatting code UU:MM that still restarts counting at every 24.
> With formatting code [UU]:MM it shows the number => 24.
> 
> Is that expected?

(happy of course to open separate report)
Comment 14 Eike Rathke 2022-05-16 09:45:28 UTC
(In reply to Cor Nouws from comment #12)
> Found an older example. With the SUM formula and a sum > 24 hours.
> With formatting code UU:MM that still restarts counting at every 24.
> With formatting code [UU]:MM it shows the number => 24.
If you are talking about using SUM() as cell function then that is expected, HH:MM displays wall clock time, wrapping to 0 at 24h.

Though we should be able to detect that for simple cases like a newly entered SUM() in a so far unformatted cell and apply the [HH]:MM format automatically instead of HH:MM. We do that already for the + and - operators under some circumstances, for functions it may just be lacking propagation.

Please create a new bug for this.