From 00e8da7dc45793f9664e7808d95e3be569b1eda4 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 8e601ca48e..064a4c8982 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