Bugzilla – Attachment 59740 Details for
Bug 17941
CanBookBeRenewed is very inefficient/slow
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Try to recreate CanBookBeRenewed perf issue
Try-to-recreate-CanBookBeRenewed-perf-issue.patch (text/plain), 2.35 KB, created by
Jonathan Druart
on 2017-02-01 13:10:12 UTC
(
hide
)
Description:
Try to recreate CanBookBeRenewed perf issue
Filename:
MIME Type:
Creator:
Jonathan Druart
Created:
2017-02-01 13:10:12 UTC
Size:
2.35 KB
patch
obsolete
>From a76e853dfcfbf87b4ddc201efed08b7bb98e8c44 Mon Sep 17 00:00:00 2001 >From: Jonathan Druart <jonathan.druart@bugs.koha-community.org> >Date: Wed, 1 Feb 2017 14:09:12 +0100 >Subject: [PATCH] Try to recreate CanBookBeRenewed perf issue > >https://bugs.koha-community.org/show_bug.cgi?id=17941 >--- > test.pl | 51 +++++++++++++++++++++++++++++++++++++++++++++++++++ > 1 file changed, 51 insertions(+) > create mode 100644 test.pl > >diff --git a/test.pl b/test.pl >new file mode 100644 >index 0000000..b2be4c6 >--- /dev/null >+++ b/test.pl >@@ -0,0 +1,51 @@ >+use C4::Context; >+use C4::Items; >+use C4::Members; >+use Koha::Patron::Categories; >+use Koha::Biblios; >+use Koha::Libraries; >+my $biblio = Koha::Biblios->search->next; >+my $library = Koha::Libraries->search->next; >+my $patron_category = Koha::Patron::Categories->next; >+my $patron = Koha::Patrons->next; >+C4::Context->_new_userenv('DUMMY SESSION'); >+C4::Context->set_userenv( 0, 0, 0, 'firstname', 'surname', >+ $library->{branchcode}, >+ 'Library 1', 0, '', '' ); >+C4::Context->set_preference( 'AllowRenewalIfOtherItemsAvailable', 1 ); >+ >+my ( @itemnumbers, @borrowernumbers ); >+for my $i ( 1 .. 20 ) { >+ warn "Adding item $i"; >+ my ( undef, undef, $itemnumber ) = C4::Items::AddItem( >+ { >+ homebranch => $library->branchcode, >+ holdingbranch => $library->branchcode, >+ barcode => "barcode_$i" >+ }, >+ $biblio->biblionumber >+ ); >+ push @itemnumbers, $itemnumber; >+} >+ >+for my $i ( 1 .. 201 ) { >+ warn "Adding patron $i"; >+ my ( $borrowernumber, undef ) = C4::Members::AddMember( >+ categorycode => $patron_category->categorycode, >+ branchcode => $library->branchcode >+ ); >+ push @borrowernumbers, $borrowernumber; >+} >+ >+C4::Circulation::AddIssue( $patron->unblessed, "barcode_1" ); >+for my $i ( 1 .. 200 ) { >+ warn "Adding hold $i"; >+ my $patron = Koha::Patrons->find( $borrowernumbers[ $i - 1 ] ); >+ my $itemnumber = $itemnumbers[ $i % 19 + 1 ]; >+ C4::Reserves::AddReserve( $library->branchcode, $patron->unblessed, >+ $biblio->biblionumber, undef, undef, undef, undef, undef, undef, >+ $itemnumber ); >+} >+ >+#my $checkout = Koha::Checkouts->search({ borrowernumber => $patron->borrowernumber })->next; >+#C4::Circulation::CanBookBeRenewed({ $patron->borrowernumber, $checkout->itemnumber }); >-- >2.9.3
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 17941
:
59740
|
60181
|
60184
|
60185
|
60186
|
60188
|
60189
|
60190
|
60191
|
60192
|
60457
|
60472
|
60473
|
60474
|
60544
|
60545
|
60546