Bug 17801

Summary: 'Top Most-circulated items' gives wrong results when filtering by checkout date
Product: Koha Reporter: Katrin Fischer <katrin.fischer>
Component: ReportsAssignee: Andrew Fuerste-Henry <andrewfh>
Status: CLOSED FIXED QA Contact: Testopia <testopia>
Severity: normal    
Priority: P5 - low CC: aleisha, andrewfh, fridolin.somers, lucas, marjorie.barry-vila, martin.renvoize, micah.bucy, victor
Version: master   
Hardware: All   
OS: All   
Change sponsored?: --- Patch complexity: Trivial patch
Documentation contact: Documentation submission:
Text to go in the release notes:
Version(s) released in:
20.11.00, 20.05.04, 19.11.10
Bug Depends on:    
Bug Blocks: 10188    
Attachments: Bug 17801: Use issuedate for limits in Most Circulated Items
Bug 17801: Use issuedate for limits in Most Circulated Items
Bug 17801: Use issuedate for limits in Most Circulated Items

Description Katrin Fischer 2016-12-21 08:55:09 UTC
We had a library reporting that records show up on this report that haven't been checked out within the selected date range of checkout dates.

After looking at the script I think this is because it checks the timestamp column instead of the issuedate of old_issues.

In old_issues the timestamp is the date of return, so that's not right and explains the results the library reported.

Side note: the report does also not seem to count current checkouts as it avoids the issues table?
Comment 1 Katrin Fischer 2019-04-26 09:21:19 UTC
Appears to be still valid.
Comment 2 Andrew Fuerste-Henry 2020-08-27 17:10:47 UTC
+1, still valid
Comment 3 Andrew Fuerste-Henry 2020-08-27 18:05:53 UTC
Created attachment 109246 [details] [review]
Bug 17801: Use issuedate for limits in Most Circulated Items

To test:
1 - Have two checkouts in old_issues
    issue 1: timestamp 2020-08-01 00:00:00, issuedate 2019-08-01 00:00:00
    issue 2: timestamp 2020-07-01 00:00:00, issuedate 2019-07-01 00:00:00
2 - Perform a Most Circulated Items search for checkout dates 2020-06-01 to 2020-09-01. Both checkouts appear in search
3 - Repeat search with checkout dates 2019-06-01 to 2019-09-01. Neither checkout appears in search
4 - apply patch, restart all
5 - Repeat search with checkout dates 2020-06-01 to 2020-09-01. Neither checkout appears in search
6 - Repeat search with checkout dates 2019-06-01 to 2019-09-01. Both checkouts appears in search
Comment 4 Fridolin Somers 2020-09-03 08:42:34 UTC
Created attachment 109588 [details] [review]
Bug 17801: Use issuedate for limits in Most Circulated Items

To test:
1 - Have two checkouts in old_issues
    issue 1: timestamp 2020-08-01 00:00:00, issuedate 2019-08-01 00:00:00
    issue 2: timestamp 2020-07-01 00:00:00, issuedate 2019-07-01 00:00:00
2 - Perform a Most Circulated Items search for checkout dates 2020-06-01 to 2020-09-01. Both checkouts appear in search
3 - Repeat search with checkout dates 2019-06-01 to 2019-09-01. Neither checkout appears in search
4 - apply patch, restart all
5 - Repeat search with checkout dates 2020-06-01 to 2020-09-01. Neither checkout appears in search
6 - Repeat search with checkout dates 2019-06-01 to 2019-09-01. Both checkouts appears in search

Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
Comment 5 Fridolin Somers 2020-09-03 08:43:13 UTC
Indeed, timestamp can not be trusted.
Nice work ;)
Comment 6 Martin Renvoize 2020-09-03 09:12:32 UTC
Created attachment 109597 [details] [review]
Bug 17801: Use issuedate for limits in Most Circulated Items

To test:
1 - Have two checkouts in old_issues
    issue 1: timestamp 2020-08-01 00:00:00, issuedate 2019-08-01 00:00:00
    issue 2: timestamp 2020-07-01 00:00:00, issuedate 2019-07-01 00:00:00
2 - Perform a Most Circulated Items search for checkout dates 2020-06-01 to 2020-09-01. Both checkouts appear in search
3 - Repeat search with checkout dates 2019-06-01 to 2019-09-01. Neither checkout appears in search
4 - apply patch, restart all
5 - Repeat search with checkout dates 2020-06-01 to 2020-09-01. Neither checkout appears in search
6 - Repeat search with checkout dates 2019-06-01 to 2019-09-01. Both checkouts appears in search

Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Comment 7 Martin Renvoize 2020-09-03 09:13:52 UTC
Another nice old one to have squelched.

Works well, trivial patch..

Passing QA
Comment 8 Fridolin Somers 2020-09-03 09:17:04 UTC
> Side note: the report does also not seem to count current checkouts as it avoids the issues table?
See Bug 10188
Comment 9 Fridolin Somers 2020-09-03 09:18:01 UTC
*** Bug 12628 has been marked as a duplicate of this bug. ***
Comment 10 Jonathan Druart 2020-09-03 13:04:18 UTC
Pushed to master for 20.11, thanks to everybody involved!
Comment 11 Fridolin Somers 2020-09-10 07:12:03 UTC
A lot of libraries have seen this bug, please backport to stable branches.
Comment 12 Lucas Gass 2020-09-14 21:48:22 UTC
backported to 20.05.x for 20.05.04
Comment 13 Aleisha Amohia 2020-09-15 11:49:38 UTC
backported to 19.11.x for 19.11.10
Comment 14 Fridolin Somers 2020-09-17 10:50:27 UTC
Great :D thanks a lot
Comment 15 Victor Grousset/tuxayo 2020-09-20 19:22:57 UTC
Not backported to oldoldstable (19.05.x). Feel free to ask if it's needed.