Bugzilla – Attachment 113525 Details for
Bug 26963
Improve Koha::Item::pickup_locations performance
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 26963: (follow-up) Change subroutine name for QA tools
Bug-26963-follow-up-Change-subroutine-name-for-QA-.patch (text/plain), 4.89 KB, created by
Tomás Cohen Arazi (tcohen)
on 2020-11-11 18:26:09 UTC
(
hide
)
Description:
Bug 26963: (follow-up) Change subroutine name for QA tools
Filename:
MIME Type:
Creator:
Tomás Cohen Arazi (tcohen)
Created:
2020-11-11 18:26:09 UTC
Size:
4.89 KB
patch
obsolete
>From 72c2b52def7a1c2f2e77335d7a2f6bba24854c85 Mon Sep 17 00:00:00 2001 >From: Nick Clemens <nick@bywatersolutions.com> >Date: Wed, 11 Nov 2020 02:37:55 +0000 >Subject: [PATCH] Bug 26963: (follow-up) Change subroutine name for QA tools > >It didn't like the ending _at > >Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com> >Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io> >--- > Koha/Item.pm | 8 ++++---- > t/db_dependent/Koha/Item.t | 18 +++++++++--------- > 2 files changed, 13 insertions(+), 13 deletions(-) > >diff --git a/Koha/Item.pm b/Koha/Item.pm >index 9766d8be295..71f6b7827b8 100644 >--- a/Koha/Item.pm >+++ b/Koha/Item.pm >@@ -553,9 +553,9 @@ sub can_be_transferred { > > } > >-=head3 _can_pickup_at >+=head3 _can_pickup_locations > >-$item->_can_pickup_at({ to => $to_libraries, from => $from_library }) >+$item->_can_pickup_locations({ to => $to_libraries, from => $from_library }) > Checks if an item can be transferred to given libraries. > > This feature is controlled by two system preferences: >@@ -577,7 +577,7 @@ If checking only one library please use $item->can_be_transferred. > > =cut > >-sub _can_pickup_at { >+sub _can_pickup_locations { > my ($self, $params ) = @_; > > my $to = $params->{to}; >@@ -658,7 +658,7 @@ sub pickup_locations { > })->as_list; > } > >- my $pickup_locations = $self->_can_pickup_at({ >+ my $pickup_locations = $self->_can_pickup_locations({ > to => \@libs > }); > >diff --git a/t/db_dependent/Koha/Item.t b/t/db_dependent/Koha/Item.t >index d24416045dd..e8fd36a9a8d 100755 >--- a/t/db_dependent/Koha/Item.t >+++ b/t/db_dependent/Koha/Item.t >@@ -339,7 +339,7 @@ subtest 'pickup_locations' => sub { > $schema->storage->txn_rollback; > }; > >-subtest '_can_pickup_at' => sub { >+subtest '_can_pickup_locations' => sub { > plan tests =>8; > > $schema->storage->txn_begin; >@@ -359,7 +359,7 @@ subtest '_can_pickup_at' => sub { > > my @to = ( $library1, $library2, $library3, $library4 ); > >- my $pickup_locations = $item->_can_pickup_at({ to => \@to }); >+ my $pickup_locations = $item->_can_pickup_locations({ to => \@to }); > is( scalar @$pickup_locations, 3, "With no transfer limits we get back the libraries that are pickup locations"); > > t::lib::Mocks::mock_preference('UseBranchTransferLimits', 1); >@@ -372,7 +372,7 @@ subtest '_can_pickup_at' => sub { > } > }); > >- $pickup_locations = $item->_can_pickup_at({ to => \@to }); >+ $pickup_locations = $item->_can_pickup_locations({ to => \@to }); > is( scalar @$pickup_locations, 2, "With a transfer limits we get back the libraries that are pickup locations minus 1 limited library"); > > $builder->build_object( { class => 'Koha::Item::Transfer::Limits', value => { >@@ -383,11 +383,11 @@ subtest '_can_pickup_at' => sub { > } > }); > >- $pickup_locations = $item->_can_pickup_at({ to => \@to }); >+ $pickup_locations = $item->_can_pickup_locations({ to => \@to }); > is( scalar @$pickup_locations, 1, "With 2 transfer limits we get back the libraries that are pickup locations minus 2 limited libraries"); > > t::lib::Mocks::mock_preference('BranchTransferLimitsType', 'ccode'); >- $pickup_locations = $item->_can_pickup_at({ to => \@to }); >+ $pickup_locations = $item->_can_pickup_locations({ to => \@to }); > is( scalar @$pickup_locations, 3, "With no transfer limits of type ccode we get back the libraries that are pickup locations"); > > $builder->build_object( { class => 'Koha::Item::Transfer::Limits', value => { >@@ -398,7 +398,7 @@ subtest '_can_pickup_at' => sub { > } > }); > >- $pickup_locations = $item->_can_pickup_at({ to => \@to }); >+ $pickup_locations = $item->_can_pickup_locations({ to => \@to }); > is( scalar @$pickup_locations, 2, "With a transfer limits we get back the libraries that are pickup locations minus 1 limited library"); > > $builder->build_object( { class => 'Koha::Item::Transfer::Limits', value => { >@@ -409,16 +409,16 @@ subtest '_can_pickup_at' => sub { > } > }); > >- $pickup_locations = $item->_can_pickup_at({ to => \@to }); >+ $pickup_locations = $item->_can_pickup_locations({ to => \@to }); > is( scalar @$pickup_locations, 1, "With 2 transfer limits we get back the libraries that are pickup locations minus 2 limited libraries"); > > >- $pickup_locations = $item->_can_pickup_at({ to => \@to, from => $library2 }); >+ $pickup_locations = $item->_can_pickup_locations({ to => \@to, from => $library2 }); > is( scalar @$pickup_locations, 3, "With transfer limits enabled but not applying because of 'from' we get back the libraries that are pickup locations"); > > t::lib::Mocks::mock_preference('UseBranchTransferLimits', 0); > >- $pickup_locations = $item->_can_pickup_at({ to => \@to }); >+ $pickup_locations = $item->_can_pickup_locations({ to => \@to }); > is( scalar @$pickup_locations, 3, "With transfer limits disabled we get back the libraries that are pickup locations"); > > }; >-- >2.29.2
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 26963
:
113282
|
113283
|
113329
|
113330
|
113333
|
113339
|
113340
|
113419
|
113420
|
113422
|
113423
|
113424
|
113425
|
113451
|
113452
|
113453
|
113454
|
113455
|
113480
|
113481
|
113483
|
113498
|
113503
|
113504
|
113505
|
113506
|
113507
|
113508
|
113509
|
113510
|
113511
|
113512
|
113513
|
113514
|
113515
|
113516
|
113517
|
113518
|
113519
|
113520
|
113521
|
113523
|
113524
| 113525 |
113526
|
113527
|
113528
|
113529
|
113530
|
113531
|
113586
|
113729