From: Doug Kyle Date: Wed, 18 Jun 2014 20:04:03 +0000 (-0400) Subject: Improved duplicates handling X-Git-Url: https://old-git.evergreen-ils.org/?a=commitdiff_plain;h=0b9ab00feb68745177b697db53f42eaed2514915;p=working%2FEvergreen.git Improved duplicates handling When all libraries have dups > threshold, order candidate libraries by least dups, most open space. Signed-off-by: Doug Kyle --- diff --git a/Open-ILS/src/sql/Pg/smart_float.sql b/Open-ILS/src/sql/Pg/smart_float.sql index eedb492814..10989fd9c2 100644 --- a/Open-ILS/src/sql/Pg/smart_float.sql +++ b/Open-ILS/src/sql/Pg/smart_float.sql @@ -159,20 +159,20 @@ BEGIN -- can item float to checkin lib? aka the shelving location is not full and has less than dups_threshold duplicate titles? - opcode := 'floated'; + opcode := 'shelf'; SELECT INTO send_lib,open_space,duplicates o.clib,o.open,d.numdups from smart_float.openings(copy_rec.location) as o join smart_float.dups(copy_rec.barcode) as d on d.clib=o.clib where o.clib=chkin_org and o.open>0 and (d.numdups0 and (d.numdups0 AND evergreen.can_float(copy_rec.floating,copy_rec.circ_lib,clib) is TRUE order by open desc limit 1; + -- lib with least dups, most open space + opcode := 'least_dups'; + SELECT INTO send_lib,open_space,duplicates o.clib,o.open,d.numdups from smart_float.openings(copy_rec.location) as o join smart_float.dups(copy_rec.barcode) as d on d.clib=o.clib where o.open>0 AND evergreen.can_float(copy_rec.floating,copy_rec.circ_lib,o.clib) is TRUE order by d.numdups,o.open desc limit 1; IF NOT FOUND THEN -- otherwise no sense in transiting item -- floating to checkin lib because it can't go anywhere else - opcode := 'nogo_floated'; + opcode := 'nogo_shelf'; send_lib := chkin_org; END IF; END IF;