Bugzilla – Attachment 60181 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]
local transformation that will greatly improve the performance
canbookberenewed.patch (text/plain), 2.47 KB, created by
Francesco Rivetti
on 2017-02-14 10:32:44 UTC
(
hide
)
Description:
local transformation that will greatly improve the performance
Filename:
MIME Type:
Creator:
Francesco Rivetti
Created:
2017-02-14 10:32:44 UTC
Size:
2.47 KB
patch
obsolete
>diff --git a/C4/Circulation.pm b/C4/Circulation.pm >index 330923e..cf43075 100644 >--- a/C4/Circulation.pm >+++ b/C4/Circulation.pm >@@ -2679,24 +2679,23 @@ sub CanBookBeRenewed : PureFunction { > # can be filled with available items. We can get the union of the sets simply > # by pushing all the elements onto an array and removing the duplicates. > my @reservable; >- foreach my $b (@borrowernumbers) { >- my ($borr) = C4::Members::GetMember( borrowernumber => $b); >- foreach my $i (@itemnumbers) { >- my $item = GetItem($i); >- if ( !IsItemOnHoldAndFound($i) >- && IsAvailableForItemLevelRequest( $item, $borr ) >- && CanItemBeReserved( $b, $i ) ) >- { >- push( @reservable, $i ); >+ my %borrowers; >+ ITEM: foreach my $i (@itemnumbers) { >+ my $item = GetItem($i); >+ next if IsItemOnHoldAndFound($i); >+ for my $b (@borrowernumbers) { >+ my $borr = $borrowers{$b}//= C4::Members::GetMember(borrowernumber => $_); >+ next unless IsAvailableForItemLevelRequest($item, $borr); >+ next unless CanItemBeReserved($b,$i); >+ >+ push @reservable, $i; >+ if (@reservable >= @borrowernumbers) { >+ $resfound = 0; >+ last ITEM; > } >+ last; > } > } >- >- @reservable = uniq(@reservable); >- >- if ( @reservable >= @borrowernumbers ) { >- $resfound = 0; >- } > } > } > return ( 0, "on_reserve" ) if $resfound; # '' when no hold was found >diff --git a/reserve/request.pl b/reserve/request.pl >index 3f4dba3..a022c99 100755 >--- a/reserve/request.pl >+++ b/reserve/request.pl >@@ -512,6 +512,7 @@ foreach my $biblionumber (@biblionumbers) { > } @reserves > ) > { >+ my $priority = $res->priority(); > my %reserve; > my @optionloop; > for ( my $i = 1 ; $i <= $totalcount ; $i++ ) { >@@ -519,7 +520,7 @@ foreach my $biblionumber (@biblionumbers) { > @optionloop, > { > num => $i, >- selected => ( $i == $res->priority() ), >+ selected => ( $i == $priority ), > } > ); > }
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