From: Dan Wells Date: Wed, 8 May 2013 19:09:41 +0000 (-0400) Subject: Fix logic in get_compressed_holdings() X-Git-Url: https://old-git.evergreen-ils.org/?a=commitdiff_plain;h=f43b06a5e24748ec59d085d2e87ffe27cda5a0b3;p=working%2FEvergreen.git Fix logic in get_compressed_holdings() This commit rearranges some of the logic branches to protect against an unusual case of having two holding statements with the same start value, but one being open-ended and one not. See the test case in the previous commit for more clarity. Signed-off-by: Dan Wells --- diff --git a/Open-ILS/src/perlmods/lib/OpenILS/Utils/MFHD.pm b/Open-ILS/src/perlmods/lib/OpenILS/Utils/MFHD.pm index dff006649e..82a02bef13 100644 --- a/Open-ILS/src/perlmods/lib/OpenILS/Utils/MFHD.pm +++ b/Open-ILS/src/perlmods/lib/OpenILS/Utils/MFHD.pm @@ -390,10 +390,8 @@ sub get_compressed_holdings { if ($runner eq $holding) { $curr_holding->extend; $runner->increment; - } elsif ($runner gt $holding) { # should not happen unless holding is not in series - carp("Found unexpected holding, skipping"); } elsif ($holding->is_open_ended) { # special case, as it will always be the last - if ($runner eq $holding->clone->compressed_to_first) { + if ($runner ge $holding->clone->compressed_to_first) { $curr_holding->compressed_end(); } else { push(@comp_holdings, $curr_holding); @@ -402,6 +400,8 @@ sub get_compressed_holdings { $curr_holding->seqno($seqno); } last; + } elsif ($runner gt $holding) { # should not happen unless holding is not in series + carp("Found unexpected holding, skipping"); } else { push(@comp_holdings, $curr_holding);