https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=17941 --- Comment #23 from M. Tompsett <mtompset@hotmail.com> --- Comment on attachment 60189 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=60189 Bug 17941 avoid scanning the full cartesian product Review of attachment 60189: --> (https://bugs.koha-community.org/bugzilla3/page.cgi?id=splinter.html&bug=17941&attachment=60189) ----------------------------------------------------------------- Love the optimization, but two tiny code changes would improve readability. ::: C4/Circulation.pm @@ +2683,5 @@
+ 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 => $_);
Could we avoid $_? It is harder to read. Here it should be $b. @@ +2687,5 @@
+ my $borr = $borrowers{$b}//= C4::Members::GetMember(borrowernumber => $_); + next unless IsAvailableForItemLevelRequest($item, $borr); + next unless CanItemBeReserved($b,$i); + + push @reservable;
The old code is pushing item numbers into the reservable array. This seems to be using an implicit $_ type behaviour, which I believe is $b. This isn't code equivalent, and explicit is always easier for debugging later. Though, I don't think it will matter, which is probably why it was optimized this way. Still, could we be explicit? It's easier to read. -- You are receiving this mail because: You are watching all bug changes.