Bug 33691

Summary: Improve query for do_check_for_previous_checkout
Product: Koha Reporter: Kyle M Hall (khall) <kyle>
Component: Architecture, internals, and plumbingAssignee: Kyle M Hall (khall) <kyle>
Status: Failed QA --- QA Contact: Marcel de Rooy <m.de.rooy>
Severity: enhancement    
Priority: P5 - low CC: m.de.rooy
Version: Main   
Hardware: All   
OS: All   
Change sponsored?: --- Patch complexity: ---
Documentation contact: Documentation submission:
Text to go in the release notes:
Version(s) released in:
Circulation function:
Attachments: Bug 33691: Improve query for do_check_for_previous_checkout
Bug 33691: Improve query for do_check_for_previous_checkout
Bug 33691: Improve query for do_check_for_previous_checkout
Bug 33691: Improve query for do_check_for_previous_checkout
Bug 33691: Improve query for do_check_for_previous_checkout

Description Kyle M Hall (khall) 2023-05-05 17:51:17 UTC
do_check_for_previous_checkout will pass a list of itemnumbers as part of the query. This could be hundreds of items or more. It makes sense to check by biblionumber instead when possible.
Comment 1 Kyle M Hall (khall) 2023-05-05 17:52:50 UTC
Created attachment 150782 [details] [review]
Bug 33691: Improve query for do_check_for_previous_checkout

do_check_for_previous_checkout will pass a list of itemnumbers as part of the query. This could be hundreds of items or more. It makes sense to check by biblionumber instead when possible.

Test Plan:
1) prove t/db_dependent/Patron/Borrower_PrevCheckout.t
2) Apply this patch
3) prove t/db_dependent/Patron/Borrower_PrevCheckout.t
4) Test still pass!
Comment 2 Kyle M Hall (khall) 2023-05-05 17:57:26 UTC
Created attachment 150783 [details] [review]
Bug 33691: Improve query for do_check_for_previous_checkout

do_check_for_previous_checkout will pass a list of itemnumbers as part of the query. This could be hundreds of items or more. It makes sense to check by biblionumber instead when possible.

Test Plan:
1) prove t/db_dependent/Patron/Borrower_PrevCheckout.t
2) Apply this patch
3) prove t/db_dependent/Patron/Borrower_PrevCheckout.t
4) Test still pass!
Comment 3 Kyle M Hall (khall) 2023-05-05 17:58:20 UTC
Created attachment 150784 [details] [review]
Bug 33691: Improve query for do_check_for_previous_checkout

do_check_for_previous_checkout will pass a list of itemnumbers as part of the query. This could be hundreds of items or more. It makes sense to check by biblionumber instead when possible.

Test Plan:
1) prove t/db_dependent/Patron/Borrower_PrevCheckout.t
2) Apply this patch
3) prove t/db_dependent/Patron/Borrower_PrevCheckout.t
4) Test still pass!
Comment 4 Kyle M Hall (khall) 2023-05-05 17:59:05 UTC
Created attachment 150785 [details] [review]
Bug 33691: Improve query for do_check_for_previous_checkout

do_check_for_previous_checkout will pass a list of itemnumbers as part of the query. This could be hundreds of items or more. It makes sense to check by biblionumber instead when possible.

Test Plan:
1) prove t/db_dependent/Patron/Borrower_PrevCheckout.t
2) Apply this patch
3) prove t/db_dependent/Patron/Borrower_PrevCheckout.t
4) Test still pass!
Comment 5 David Nind 2023-05-09 01:44:15 UTC
Created attachment 150818 [details] [review]
Bug 33691: Improve query for do_check_for_previous_checkout

do_check_for_previous_checkout will pass a list of itemnumbers as part of the query. This could be hundreds of items or more. It makes sense to check by biblionumber instead when possible.

Test Plan:
1) prove t/db_dependent/Patron/Borrower_PrevCheckout.t
2) Apply this patch
3) prove t/db_dependent/Patron/Borrower_PrevCheckout.t
4) Test still pass!

Signed-off-by: David Nind <david@davidnind.com>
Comment 6 Marcel de Rooy 2023-05-10 14:48:01 UTC
    my @item_nos;
[..]
        @item_nos = $biblio->items->get_column( 'itemnumber' );

And now we are fetching lots of item numbers and doing nothing with them?

Could you explain why we can miss the item numbers in general here ?