]> git.evergreen-ils.org Git - Evergreen.git/commit
LP#1511828: sort proximities numerically when targeting holds
authorJosh Stompro <stomproj@larl.org>
Sat, 31 Oct 2015 15:38:41 +0000 (10:38 -0500)
committerGalen Charlton <gmc@esilibrary.com>
Thu, 5 Nov 2015 18:39:12 +0000 (18:39 +0000)
commit2c413ef29afd84b79693beaf64f89a5fd1f2bb90
tree198816ad92894e7af72330a823d4ef8280133b7b
parentec8383ef5b0c0c52f489dca55f402ca21ebc6851
LP#1511828: sort proximities numerically when targeting holds

The hold targeter had three instances of using lexical sorting
rather than numerical sorting.

Two of the instances affected hold targeting if proximity values were
over 9.  Proximity values were being sorted lexically. For instance,
1,2,5,11,15,100,120 was sorted as 1,100,11,120,15,2,5, causing
interesting hold targeting results. Normally proximity doesn't go
that high so it isn't a problem, but we were using proximity adjustments
to strictly order locations so each location had a different proximity,
driving the numbers above 9.

One instance wasn't causing any current issue but could cause problems in
the future if more best hold selection sort options are added to bring the
total number of sort options over 9.

Also included are some changes to reduce warnings in the logs
suggested by Bill Erickson.  The sorting problem was found by
Galen Charlton, thanks Galen.

Testing Notes - to trigger this issue you need to have adjusted
  proximities over 9.

1. Use proximity adjustment rules to add a +10 proximity adjustment to
  one item circ lib, Branch A and a +2 proximity adjustment to the
  item circ lib Branch B.

2. Find a title with a copy at Branch A and B. Place a hold with a
  pickup location of Branch B.

3. The copy at Branch A should get targeted since it has a proximity of
  12-14 (10+normal proximity) and Branch B has a proximity of 2
  (2+normal proximity).  12 gets sorted before 2 lexically.

4. After the fix the copy at Branch B should get targeted since 2
  is sorted before 12.

Signed-off-by: Josh Stompro <stomproj@larl.org>
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
Open-ILS/src/perlmods/lib/OpenILS/Application/Storage/Publisher/action.pm