Bug 25760 - Holds ratio report is not reporting on records with 1 hold
Summary: Holds ratio report is not reporting on records with 1 hold
Status: RESOLVED FIXED
Alias: None
Product: Koha
Classification: Unclassified
Component: Hold requests (show other bugs)
Version: master
Hardware: All All
: P5 - low normal with 20 votes (vote)
Assignee: Nick Clemens
QA Contact:
URL:
Keywords:
Depends on: 15422
Blocks:
  Show dependency treegraph
 
Reported: 2020-06-15 15:58 UTC by Kelly McElligott
Modified: 2021-05-25 14:37 UTC (History)
7 users (show)

See Also:
Change sponsored?: ---
Patch complexity: ---
Text to go in the release notes:
Version(s) released in:
21.05.00,20.11.06,20.05.12


Attachments
Bug 25760: (bug 15422 follow-up) Display record with hold ratio == 1 (2.02 KB, patch)
2020-06-16 11:53 UTC, Jonathan Druart
Details | Diff | Splinter Review
Bug 25760: (follow-up) Restore use of ceil (1.07 KB, patch)
2020-09-14 12:35 UTC, ByWater Sandboxes
Details | Diff | Splinter Review
Bug 25760: (follow-up) Restore use of ceil (1.13 KB, patch)
2020-09-14 14:57 UTC, ByWater Sandboxes
Details | Diff | Splinter Review
Bug 25760: (bug 15422 follow-up) Display record with hold ratio == 1 (2.08 KB, patch)
2020-09-14 15:09 UTC, ByWater Sandboxes
Details | Diff | Splinter Review
Bug 25760: (follow-up) Restore use of ceil (1.19 KB, patch)
2020-09-14 15:09 UTC, ByWater Sandboxes
Details | Diff | Splinter Review
Bug 25760: [Alternate] (bug 15422 follow-up) Display record with hold ratio greater than or equal to the value entered (5.00 KB, patch)
2021-01-08 20:16 UTC, Nick Clemens
Details | Diff | Splinter Review
Bug 25760: [Alternate] (bug 15422 follow-up) Display record with hold ratio greater than or equal to the value entered (5.37 KB, patch)
2021-04-08 13:47 UTC, Frank Hansen
Details | Diff | Splinter Review
Bug 25760: [Alternate] (bug 15422 follow-up) Display record with hold ratio greater than or equal to the value entered (5.42 KB, patch)
2021-04-09 14:29 UTC, Galen Charlton
Details | Diff | Splinter Review
Bug 25760: [Alternate] (bug 15422 follow-up) Display record with hold ratio greater than or equal to the value entered (5.42 KB, patch)
2021-05-09 15:11 UTC, Katrin Fischer
Details | Diff | Splinter Review
Bug 25760: [Alternate] (bug 15422 follow-up) Display record with hold ratio greater than or equal to the value entered (5.48 KB, patch)
2021-05-10 12:25 UTC, Nick Clemens
Details | Diff | Splinter Review

Note You need to log in before you can comment on or make changes to this bug.
Description Kelly McElligott 2020-06-15 15:58:17 UTC
Currently, the holds report ratio found in the circulation module can be altered and run with a specific number to look for a ratio of holds to a record.  Prior to 19.11, this report would report on 1 or more holds, if that was entered into the search box.  If this report is run with a 1 in the search, Koha will only display records with 2 or more holds.
Comment 1 Kelly McElligott 2020-06-15 16:58:19 UTC
Andrew brought up an interesting point on this, if you run this for a ratio of 2 holds, Koha will only give records with 3+ holds. If you run this for a ratio of 3, you will get 4+ (holds on a record).  Is it missing the = to portion of the statement?
Comment 2 Jonathan Druart 2020-06-16 11:53:44 UTC
Created attachment 105907 [details] [review]
Bug 25760: (bug 15422 follow-up) Display record with hold ratio == 1

If the hold ratio is 1 (ie. number of holds == number of copies), we
should display it if it's the value in the filter.

Test plan:
1. Create bibliographic records with 1, 2 and 3 items
2. Place 1 hold on each of them
3. Go to the Hold ratios report and search with ratio = 1, 2 then 3
4. Place another hold on each of the record
5. Repeat 3
6. Make sure there is no regression in the test plan of bug 15422
Comment 3 Agnes Rivers-Moore 2020-08-29 15:28:49 UTC
Kelly is right - we tested the same. This report is suddenly using "greater than" instead of "Greater than or equal" for any ratio value.
It used to work correctly - that is, if you enter a ratio of 1 you get all titles with holds, ratio of 2 you get all titles with two or more holds per copy and so on.
Hint from Equinox staff as a workaround for now - enter less than one (0.9) as the ratio to get all holds.
Comment 4 Jonathan Druart 2020-08-31 08:07:43 UTC
Hello Agnes, could you test the patch attached to this bug report?
Comment 5 Agnes Rivers-Moore 2020-08-31 13:48:19 UTC
Regret, just a librarian, not sysadmin. I will ask Equinox support if they can.
Comment 6 ByWater Sandboxes 2020-09-14 12:35:32 UTC
Created attachment 110053 [details] [review]
Bug 25760: (follow-up) Restore use of ceil

The ceiling function here ensures that partial copies are counted as full copies i.e.
if we need half a book to reach the ratio, we should report 1 book, not 0
Comment 7 ByWater Sandboxes 2020-09-14 14:57:57 UTC
Created attachment 110062 [details] [review]
Bug 25760: (follow-up) Restore use of ceil

The ceiling function here ensures that partial copies are counted as full copies i.e.
if we need half a book to reach the ratio, we should report 1 book, not 0

Signed-off-by: Kelly McElligott <kelly@bywatersolutions.com>
Comment 8 ByWater Sandboxes 2020-09-14 15:09:11 UTC
Created attachment 110063 [details] [review]
Bug 25760: (bug 15422 follow-up) Display record with hold ratio == 1

If the hold ratio is 1 (ie. number of holds == number of copies), we
should display it if it's the value in the filter.

Test plan:
1. Create bibliographic records with 1, 2 and 3 items
2. Place 1 hold on each of them
3. Go to the Hold ratios report and search with ratio = 1, 2 then 3
4. Place another hold on each of the record
5. Repeat 3
6. Make sure there is no regression in the test plan of bug 15422

Signed-off-by: Kelly McElligott <kelly@bywatersolutions.com>
Comment 9 ByWater Sandboxes 2020-09-14 15:09:34 UTC
Created attachment 110064 [details] [review]
Bug 25760: (follow-up) Restore use of ceil

The ceiling function here ensures that partial copies are counted as full copies i.e.
if we need half a book to reach the ratio, we should report 1 book, not 0

Signed-off-by: Kelly McElligott <kelly@bywatersolutions.com>

Signed-off-by: Kelly McElligott <kelly@bywatersolutions.com>
Comment 10 Victor Grousset/tuxayo 2020-12-11 17:42:30 UTC
These patches are already signed off right?
Comment 11 Nick Clemens 2021-01-08 20:15:41 UTC
This doesn't work - Titles with 1 item and any holds will show up for all ratios:
ceil( 1/x - 1) = 1
True for positive integers x
Comment 12 Nick Clemens 2021-01-08 20:16:12 UTC
Created attachment 114978 [details] [review]
Bug 25760: [Alternate] (bug 15422 follow-up) Display record with hold ratio greater than or equal to the value entered

On bug 15422 we made it so that only holds with copies to buy to acheive the holds ratio
showed

Users have reported that they want to see record where there are 0 copies to buy i.e.
the holds ration matches the value entered

This patch changes the criteria for returning holds to be if the ratio for a given title
is equal to or greater then the ratio specified in the form

I also renamed 'ratiocalc' to 'copies_to_buy' since that is what is contains

Test plan:
1. Create bibliographic records with 1, 2 and 3 items
2. Place 1 hold on each of them
3. Go to the Hold ratios report and search with ratio = 1, 2 then 3
4. You expect to see:
   the title with 1 item with ratio 1
   nothing otherwise
5. Place another hold on each of the record
6. Repeat 3 you expect to see:
   titles with 1 or 2 items with ratio 1
   title with 1 item for ratio 2
   nothing with ratio 3
7. Place another hold on each of the record
8. Repeat 3 you expect to see:
   titles with 1 or 2 or 3 items with ratio 1
   title with 1 item or 2 items for ratio 2
   nothing with ratio 3
9. Make sure there is no regression in the test plan of bug 15422
Comment 13 Stina Hallin 2021-02-15 10:00:35 UTC
CONFLICT (content): Merge conflict in circ/reserveratios.pl
error: Failed to merge in the changes.
Patch failed at 0001 Bug 25760: [Alternate] (bug 15422 follow-up) Display record with hold ratio greater than or equal to the value entered
The copy of the patch that failed is found in: .git/rebase-apply/patch
Comment 14 Frank Hansen 2021-04-08 13:47:32 UTC
Created attachment 119324 [details] [review]
Bug 25760: [Alternate] (bug 15422 follow-up) Display record with hold ratio greater than or equal to the value entered

On bug 15422 we made it so that only holds with copies to buy to acheive the holds ratio
showed

Users have reported that they want to see record where there are 0 copies to buy i.e.
the holds ration matches the value entered

This patch changes the criteria for returning holds to be if the ratio for a given title
is equal to or greater then the ratio specified in the form

I also renamed 'ratiocalc' to 'copies_to_buy' since that is what is contains

Test plan:
1. Create bibliographic records with 1, 2 and 3 items
2. Place 1 hold on each of them
3. Go to the Hold ratios report and search with ratio = 1, 2 then 3
4. You expect to see:
   the title with 1 item with ratio 1
   nothing otherwise
5. Place another hold on each of the record
6. Repeat 3 you expect to see:
   titles with 1 or 2 items with ratio 1
   title with 1 item for ratio 2
   nothing with ratio 3
7. Place another hold on each of the record
8. Repeat 3 you expect to see:
   titles with 1 or 2 or 3 items with ratio 1
   title with 1 item or 2 items for ratio 2
   nothing with ratio 3
9. Make sure there is no regression in the test plan of bug 15422

Signed-off-by: Frank Hansen <frank.hansen@ub.lu.se>

I was able to apply the patch and test it.

Some comments.
When I adding the third hold on each record in step 7, It will result in
the following result:

titles with 1 or 2 or 3 items with ratio 1
title with 1 items with ratio 2 because the title with 2 items will get
a ratio of 1.50 and not 2.
title with 1 items with with ratio 3
Comment 15 Galen Charlton 2021-04-09 14:29:30 UTC
Created attachment 119385 [details] [review]
Bug 25760: [Alternate] (bug 15422 follow-up) Display record with hold ratio greater than or equal to the value entered

On bug 15422 we made it so that only holds with copies to buy to acheive the holds ratio
showed

Users have reported that they want to see record where there are 0 copies to buy i.e.
the holds ration matches the value entered

This patch changes the criteria for returning holds to be if the ratio for a given title
is equal to or greater then the ratio specified in the form

I also renamed 'ratiocalc' to 'copies_to_buy' since that is what is contains

Test plan:
1. Create bibliographic records with 1, 2 and 3 items
2. Place 1 hold on each of them
3. Go to the Hold ratios report and search with ratio = 1, 2 then 3
4. You expect to see:
   the title with 1 item with ratio 1
   nothing otherwise
5. Place another hold on each of the record
6. Repeat 3 you expect to see:
   titles with 1 or 2 items with ratio 1
   title with 1 item for ratio 2
   nothing with ratio 3
7. Place another hold on each of the record
8. Repeat 3 you expect to see:
   titles with 1 or 2 or 3 items with ratio 1
   title with 1 item or 2 items for ratio 2
   nothing with ratio 3
9. Make sure there is no regression in the test plan of bug 15422

Comments from Frank Hansen:

Some comments.
When I adding the third hold on each record in step 7, It will result in
the following result:

titles with 1 or 2 or 3 items with ratio 1
title with 1 items with ratio 2 because the title with 2 items will get
a ratio of 1.50 and not 2.
title with 1 items with with ratio 3

Signed-off-by: Frank Hansen <frank.hansen@ub.lu.se>
Signed-off-by: Galen Charlton <gmc@equinoxinitiative.org>
Comment 16 Galen Charlton 2021-04-09 14:31:07 UTC
Noting that entering a ratio less than 1 yields mathematically correct but perhaps unexpected results. It might be a good idea to restrict the ratio input to accept 1 as a minimum value, but I don't think that need hold up this patch.
Comment 17 Katrin Fischer 2021-05-09 15:11:52 UTC
Created attachment 120750 [details] [review]
Bug 25760: [Alternate] (bug 15422 follow-up) Display record with hold ratio greater than or equal to the value entered

On bug 15422 we made it so that only holds with copies to buy to acheive the holds ratio
showed

Users have reported that they want to see record where there are 0 copies to buy i.e.
the holds ration matches the value entered

This patch changes the criteria for returning holds to be if the ratio for a given title
is equal to or greater then the ratio specified in the form

I also renamed 'ratiocalc' to 'copies_to_buy' since that is what is contains

Test plan:
1. Create bibliographic records with 1, 2 and 3 items
2. Place 1 hold on each of them
3. Go to the Hold ratios report and search with ratio = 1, 2 then 3
4. You expect to see:
   the title with 1 item with ratio 1
   nothing otherwise
5. Place another hold on each of the record
6. Repeat 3 you expect to see:
   titles with 1 or 2 items with ratio 1
   title with 1 item for ratio 2
   nothing with ratio 3
7. Place another hold on each of the record
8. Repeat 3 you expect to see:
   titles with 1 or 2 or 3 items with ratio 1
   title with 1 item or 2 items for ratio 2
   nothing with ratio 3
9. Make sure there is no regression in the test plan of bug 15422

Comments from Frank Hansen:

Some comments.
When I adding the third hold on each record in step 7, It will result in
the following result:

titles with 1 or 2 or 3 items with ratio 1
title with 1 items with ratio 2 because the title with 2 items will get
a ratio of 1.50 and not 2.
title with 1 items with with ratio 3

Signed-off-by: Frank Hansen <frank.hansen@ub.lu.se>
Signed-off-by: Galen Charlton <gmc@equinoxinitiative.org>
Comment 18 Nick Clemens 2021-05-10 12:25:58 UTC
Created attachment 120774 [details] [review]
Bug 25760: [Alternate] (bug 15422 follow-up) Display record with hold ratio greater than or equal to the value entered

On bug 15422 we made it so that only holds with copies to buy to acheive the holds ratio
showed

Users have reported that they want to see record where there are 0 copies to buy i.e.
the holds ration matches the value entered

This patch changes the criteria for returning holds to be if the ratio for a given title
is equal to or greater then the ratio specified in the form

I also renamed 'ratiocalc' to 'copies_to_buy' since that is what is contains

Test plan:
1. Create bibliographic records with 1, 2 and 3 items
2. Place 1 hold on each of them
3. Go to the Hold ratios report and search with ratio = 1, 2 then 3
4. You expect to see:
   the title with 1 item with ratio 1
   nothing otherwise
5. Place another hold on each of the record
6. Repeat 3 you expect to see:
   titles with 1 or 2 items with ratio 1
   title with 1 item for ratio 2
   nothing with ratio 3
7. Place another hold on each of the record
8. Repeat 3 you expect to see:
   titles with 1 or 2 or 3 items with ratio 1
   title with 1 item or 2 items for ratio 2
   nothing with ratio 3
9. Make sure there is no regression in the test plan of bug 15422

Comments from Frank Hansen:

Some comments.
When I adding the third hold on each record in step 7, It will result in
the following result:

titles with 1 or 2 or 3 items with ratio 1
title with 1 items with ratio 2 because the title with 2 items will get
a ratio of 1.50 and not 2.
title with 1 items with with ratio 3

Signed-off-by: Frank Hansen <frank.hansen@ub.lu.se>
Signed-off-by: Galen Charlton <gmc@equinoxinitiative.org>

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Comment 19 Jonathan Druart 2021-05-10 14:17:43 UTC
Pushed to master for 21.05, thanks to everybody involved!
Comment 20 Fridolin Somers 2021-05-12 14:41:11 UTC
Pushed to 20.11.x for 20.11.06
Comment 21 Andrew Fuerste-Henry 2021-05-25 13:03:57 UTC
Pushed to 20.05.x for 20.05.12
Comment 22 Victor Grousset/tuxayo 2021-05-25 14:37:28 UTC
Not backported to oldoldstable (19.11.x). Feel free to ask if it's needed.