[open-ils-commits] r10263 - trunk/Open-ILS/src/perlmods/OpenILS/Application/Circ

svn at svn.open-ils.org svn at svn.open-ils.org
Tue Aug 5 13:55:43 EDT 2008


Author: erickson
Date: 2008-08-05 13:55:36 -0400 (Tue, 05 Aug 2008)
New Revision: 10263

Modified:
   trunk/Open-ILS/src/perlmods/OpenILS/Application/Circ/Holds.pm
Log:
the existing if/else construct was forcing the proximity call regardless of whether the cached value existed.  changed and tested

Modified: trunk/Open-ILS/src/perlmods/OpenILS/Application/Circ/Holds.pm
===================================================================
--- trunk/Open-ILS/src/perlmods/OpenILS/Application/Circ/Holds.pm	2008-08-05 17:17:47 UTC (rev 10262)
+++ trunk/Open-ILS/src/perlmods/OpenILS/Application/Circ/Holds.pm	2008-08-05 17:55:36 UTC (rev 10263)
@@ -1165,10 +1165,10 @@
    my $home_org = $patron->home_ou;
    my $req_org = $request_lib->id;
 
-   my $home_prox = 
-      ($prox_cache{$home_org}) ? 
-         $prox_cache{$home_org} :
-         $prox_cache{$home_org} = $e->search_actor_org_unit_proximity({from_org => $home_org});
+    $prox_cache{$home_org} = 
+        $e->search_actor_org_unit_proximity({from_org => $home_org})
+        unless $prox_cache{$home_org};
+    my $home_prox = $prox_cache{$home_org};
 
    my %buckets;
    my %hash = map { ($_->to_org => $_->prox) } @$home_prox;
@@ -1183,11 +1183,12 @@
       # directly before the farthest away copies.  That way, they are not 
       # given priority, but they are checked before the farthest copies.
       # -----------------------------------------------------------------------
-      my $req_prox = 
-         ($prox_cache{$req_org}) ? 
-            $prox_cache{$req_org} :
-            $prox_cache{$req_org} = $e->search_actor_org_unit_proximity({from_org => $req_org});
 
+        $prox_cache{$req_org} = 
+            $e->search_actor_org_unit_proximity({from_org => $req_org})
+            unless $prox_cache{$req_org};
+        my $req_prox = $prox_cache{$req_org};
+
       my %buckets2;
       my %hash2 = map { ($_->to_org => $_->prox) } @$req_prox;
       push( @{$buckets2{ $hash2{$_->{circ_lib}} } }, $_->{id} ) for @$copies;
@@ -1297,11 +1298,13 @@
    my $home_org = $patron->home_ou;
    my $req_org = $request_lib->id;
 
-   my $home_prox = 
-      ($prox_cache{$home_org}) ? 
-         $prox_cache{$home_org} :
-         $prox_cache{$home_org} = $e->search_actor_org_unit_proximity({from_org => $home_org});
+    $logger->info("prox cache $home_org " . $prox_cache{$home_org});
 
+    $prox_cache{$home_org} = 
+        $e->search_actor_org_unit_proximity({from_org => $home_org})
+        unless $prox_cache{$home_org};
+    my $home_prox = $prox_cache{$home_org};
+
    my %buckets;
    my %hash = map { ($_->to_org => $_->prox) } @$home_prox;
    push( @{$buckets{ $hash{$_->{circ_lib}} } }, $_->{id} ) for @$copies;
@@ -1315,11 +1318,12 @@
       # directly before the farthest away copies.  That way, they are not 
       # given priority, but they are checked before the farthest copies.
       # -----------------------------------------------------------------------
-      my $req_prox = 
-         ($prox_cache{$req_org}) ? 
-            $prox_cache{$req_org} :
-            $prox_cache{$req_org} = $e->search_actor_org_unit_proximity({from_org => $req_org});
+        $prox_cache{$req_org} = 
+            $e->search_actor_org_unit_proximity({from_org => $req_org})
+            unless $prox_cache{$req_org};
+        my $req_prox = $prox_cache{$req_org};
 
+
       my %buckets2;
       my %hash2 = map { ($_->to_org => $_->prox) } @$req_prox;
       push( @{$buckets2{ $hash2{$_->{circ_lib}} } }, $_->{id} ) for @$copies;



More information about the open-ils-commits mailing list