From c1e878888998f2a9dd4e588ed3e92f2c505eb7f3 Mon Sep 17 00:00:00 2001 From: Mike Rylander Date: Tue, 25 Jun 2013 07:44:22 -0400 Subject: [PATCH] Only attempt to map copies once per hold The development of Calculated Proximity Adjustment (CPA) for 2.4 added a "prox" column to action.hold_copy_map (ahcm) to store on variant of copy proximity. That value is calculated at the same time that certain other data structures are set up, and is conceptually tied to them, so the resulting combined data set is used to insert values into the ahcm. However, user configuration can cause that data set to contain non-unique values, where the data structure used previous to CPA was guaranteed to be unique. This lack of uniqueness would then violate a constraint on the achm table. This commit restores the required uniqueness for the purpose of creating the ahcm rows. Signed-off-by: Mike Rylander Signed-off-by: Lebbeous Fogle-Weekley Conflicts (whitespace only): Open-ILS/src/perlmods/lib/OpenILS/Application/Storage/Publisher/action.pm --- .../src/perlmods/lib/OpenILS/Application/Storage/Publisher/action.pm | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Open-ILS/src/perlmods/lib/OpenILS/Application/Storage/Publisher/action.pm b/Open-ILS/src/perlmods/lib/OpenILS/Application/Storage/Publisher/action.pm index d39da1c7f5..bc8cc7765f 100644 --- a/Open-ILS/src/perlmods/lib/OpenILS/Application/Storage/Publisher/action.pm +++ b/Open-ILS/src/perlmods/lib/OpenILS/Application/Storage/Publisher/action.pm @@ -1542,7 +1542,8 @@ sub new_hold_copy_targeter { my $prox_list = create_prox_list( $self, $pu_lib, $all_copies, $hold ); $log->debug( "\tMapping ".scalar(@$all_copies)." potential copies for hold ".$hold->id); for my $prox ( keys %$prox_list ) { - action::hold_copy_map->create( { proximity => $prox, hold => $hold->id, target_copy => $_->id } ) for (@{$$prox_list{$prox}}); + action::hold_copy_map->create( { proximity => $prox, hold => $hold->id, target_copy => $_ } ) + for keys( %{{ map { $_->id => 1 } @{$$prox_list{$prox}} }} ); } #$client->status( new OpenSRF::DomainObject::oilsContinueStatus ); -- 2.11.0