[Koha-bugs] [Bug 17941] CanBookBeRenewed is very inefficient/slow

bugzilla-daemon at bugs.koha-community.org bugzilla-daemon at bugs.koha-community.org
Wed Feb 15 06:36:41 CET 2017


https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=17941

M. Tompsett <mtompset at hotmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |mtompset at hotmail.com
             Status|Needs Signoff               |In Discussion

--- Comment #26 from M. Tompsett <mtompset at hotmail.com> ---
(In reply to M. Tompsett from comment #25)
> Sweet! Let's get some sign off. :)

t/db_dependent/Circulation.t does a good job of testing the revision, except
for one case!

2675             # If the count of the union of the lists of reservable items
for each borrower
2676             # is equal or greater than the number of borrowers, we know
that all reserves
2677             # can be filled with available items. We can get the union of
the sets simply
2678             # by pushing all the elements onto an array and removing the
duplicates.
2679             my @reservable;
2680             my %borrowers;
2681             print STDERR "check 1\n";
2682             ITEM: foreach my $i (@itemnumbers) {
2683             print STDERR "check 2\n";
2684                 my $item = GetItem($i);
2685                 next if IsItemOnHoldAndFound($i);
2686             print STDERR "check 3\n";
2687                 for my $b (@borrowernumbers) {
2688             print STDERR "check 4\n";
2689                     my $borr = $borrowers{$b}//=
C4::Members::GetMember(borrowernumber => $b);
2690                     next unless IsAvailableForItemLevelRequest($item,
$borr);
2691             print STDERR "check 5\n";
2692                     next unless CanItemBeReserved($b,$i);
2693             print STDERR "check 6\n";
2694
2695                     push @reservable, $i;
2696                     if (@reservable >= @borrowernumbers) {
2697             print STDERR "check 7\n";
2698                         $resfound = 0;
2699                         last ITEM;
2700                     }
2701             print STDERR "check 8\n";
2702                     last;
2703                 }
2704             }

As you can see, I added print statements, "check 8" is not triggered.

$ git checkout -b bug_17941 origin/master
$ git bz apply 17941
-- add in the STDERR's above.
$ sudo koha-shell -c bash kohadev
K$ prove -v t/db_dependent/Circulation.t 2>&1 | grep check | sort -u
-- output has check 1 through check 7, but not check 8.

So, if you could add a test which triggers check 8, that would be good.

-- 
You are receiving this mail because:
You are watching all bug changes.


More information about the Koha-bugs mailing list