Bug 37905

Summary: Correctly fix the "last hour" filter on the job list
Product: Koha Reporter: Jonathan Druart <jonathan.druart>
Component: System AdministrationAssignee: Jonathan Druart <jonathan.druart>
Status: Pushed to oldstable --- QA Contact: Martin Renvoize (ashimema) <martin.renvoize>
Severity: normal    
Priority: P5 - low CC: dcook, fridolin.somers, gmcharlt, lucas, martin.renvoize, nick
Version: unspecified   
Hardware: All   
OS: All   
Change sponsored?: --- Patch complexity: ---
Documentation contact: Documentation submission:
Text to go in the release notes:
Version(s) released in:
24.11.00,24.05.06
Circulation function:
Bug Depends on: 36217, 37902    
Bug Blocks: 37888    
Attachments: Revert "Bug 36217: Fix background jobs page's include_last_hour filter"
Bug 37905: Use the server's tz to limit the jobs by "enqueued in the last hour"
Bug 37905: Fix parameter name
Bug 37905: Use correct RFC3339 formatted date to the server
Bug 37905: Fix parameter name
Revert "Bug 36217: Fix background jobs page's include_last_hour filter"
Bug 37905: Use correct RFC3339 formatted date to the server
Bug 37905: Fix parameter name
Revert "Bug 36217: Fix background jobs page's include_last_hour filter"
Bug 37905: Use correct RFC3339 formatted date to the server
Bug 37905: Fix parameter name

Description Jonathan Druart 2024-09-12 12:49:12 UTC
See bug 36217 for more info, and especially the last comments. We want to revert what has been pushed and fix it properly with 2 lines of JS.
Comment 1 Jonathan Druart 2024-09-12 12:53:51 UTC
Created attachment 171386 [details] [review]
Revert "Bug 36217: Fix background jobs page's include_last_hour filter"

This reverts commit f5c839348091d129bb7100af2c9e64e486d0ea1d.
Comment 2 Jonathan Druart 2024-09-12 12:53:54 UTC
Created attachment 171387 [details] [review]
Bug 37905: Use the server's tz to limit the jobs by "enqueued in the last hour"

This patch suggests to revert the previous attempt to fix this problem.
The date was using the client-side's tz and so the "last hour" was not
matching the one from the server.

I have noticed a couple of things when working on this:
* We cannot pass a RFC3339 formatted date to the server (will open a
  separate bug report)
* toISOString() and the handling of timezone in dayjs is ambiguous or
  buggy
https://github.com/iamkun/dayjs/issues/2720
https://github.com/iamkun/dayjs/issues/2611

With bug 37831 with simply need to pass a rfc3339-formatted date and the
filtering will be done as expected.
Comment 3 Jonathan Druart 2024-09-12 12:53:56 UTC
Created attachment 171388 [details] [review]
Bug 37905: Fix parameter name

It's named enqueued_date on the API side, not enqueued_on (which is the DB
column's name)

No behaviour change expected here.
Comment 4 Jonathan Druart 2024-09-12 14:37:33 UTC
Created attachment 171404 [details] [review]
Bug 37905: Use correct RFC3339 formatted date to the server

This patch suggests to revert the previous attempt to fix this problem.
The date was using the client-side's tz and so the "last hour" was not
matching the one from the server.

With bug 37831 with simply need to pass a rfc3339-formatted date and the
filtering will be done as expected.
Comment 5 Jonathan Druart 2024-09-12 14:37:35 UTC
Created attachment 171405 [details] [review]
Bug 37905: Fix parameter name

It's named enqueued_date on the API side, not enqueued_on (which is the DB
column's name)

No behaviour change expected here.
Comment 6 Nick Clemens (kidclamp) 2024-09-19 13:43:39 UTC
Created attachment 171759 [details] [review]
Revert "Bug 36217: Fix background jobs page's include_last_hour filter"

This reverts commit f5c839348091d129bb7100af2c9e64e486d0ea1d.

https://bugs.koha-community.org/show_bug.cgi?id=37905
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Comment 7 Nick Clemens (kidclamp) 2024-09-19 13:43:41 UTC
Created attachment 171760 [details] [review]
Bug 37905: Use correct RFC3339 formatted date to the server

This patch suggests to revert the previous attempt to fix this problem.
The date was using the client-side's tz and so the "last hour" was not
matching the one from the server.

With bug 37831 with simply need to pass a rfc3339-formatted date and the
filtering will be done as expected.

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Comment 8 Nick Clemens (kidclamp) 2024-09-19 13:43:43 UTC
Created attachment 171761 [details] [review]
Bug 37905: Fix parameter name

It's named enqueued_date on the API side, not enqueued_on (which is the DB
column's name)

No behaviour change expected here.

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Comment 9 Nick Clemens (kidclamp) 2024-09-19 13:46:23 UTC
All works on top of 37902 - filtering as expected
Comment 10 Martin Renvoize (ashimema) 2024-10-17 15:14:46 UTC
Created attachment 172902 [details] [review]
Revert "Bug 36217: Fix background jobs page's include_last_hour filter"

This reverts commit f5c839348091d129bb7100af2c9e64e486d0ea1d.

https://bugs.koha-community.org/show_bug.cgi?id=37905
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Comment 11 Martin Renvoize (ashimema) 2024-10-17 15:14:48 UTC
Created attachment 172903 [details] [review]
Bug 37905: Use correct RFC3339 formatted date to the server

This patch suggests to revert the previous attempt to fix this problem.
The date was using the client-side's tz and so the "last hour" was not
matching the one from the server.

With bug 37831 with simply need to pass a rfc3339-formatted date and the
filtering will be done as expected.

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Comment 12 Martin Renvoize (ashimema) 2024-10-17 15:14:51 UTC
Created attachment 172904 [details] [review]
Bug 37905: Fix parameter name

It's named enqueued_date on the API side, not enqueued_on (which is the DB
column's name)

No behaviour change expected here.

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Comment 13 Martin Renvoize (ashimema) 2024-10-17 15:15:19 UTC
So glad to see this one through.. working great and considerably cleaner.

Passing QA.. thanks Jonathan!
Comment 14 Katrin Fischer 2024-10-18 12:27:38 UTC
Pushed for 24.11!

Well done everyone, thank you!
Comment 15 Lucas Gass (lukeg) 2024-11-19 15:57:42 UTC
Backported to 24.05.x for upcoming 24.05.06
Comment 16 Fridolin Somers 2024-12-13 14:02:24 UTC
(In reply to Lucas Gass (lukeg) from comment #15)
> Backported to 24.05.x for upcoming 24.05.06

But Bug 36217 is not in 24.05.x
Comment 17 David Cook 2024-12-16 00:56:03 UTC
(In reply to Fridolin Somers from comment #16)
> (In reply to Lucas Gass (lukeg) from comment #15)
> > Backported to 24.05.x for upcoming 24.05.06
> 
> But Bug 36217 is not in 24.05.x

The underlying problem I was trying to fix with bug 36217 would be though. I think it's been a bug in Koha since the introduction of background jobs. 

So would still be worth backporting I reckon.