[open-ils-commits] r16979 - trunk/Open-ILS/src/perlmods/OpenILS/Application/Circ (miker)
svn at svn.open-ils.org
svn at svn.open-ils.org
Mon Jul 19 11:07:02 EDT 2010
Author: miker
Date: 2010-07-19 11:06:59 -0400 (Mon, 19 Jul 2010)
New Revision: 16979
Modified:
trunk/Open-ILS/src/perlmods/OpenILS/Application/Circ/Holds.pm
Log:
use LEFT JOIN to allow a single query to count copies per circ mod
Modified: trunk/Open-ILS/src/perlmods/OpenILS/Application/Circ/Holds.pm
===================================================================
--- trunk/Open-ILS/src/perlmods/OpenILS/Application/Circ/Holds.pm 2010-07-19 14:06:35 UTC (rev 16978)
+++ trunk/Open-ILS/src/perlmods/OpenILS/Application/Circ/Holds.pm 2010-07-19 15:06:59 UTC (rev 16979)
@@ -1085,29 +1085,21 @@
my $hold_data = $e->json_query({
select => {
- ccm => [
- {column => 'code', transform => 'count', aggregate => 1, alias => 'count'},
- {column =>'avg_wait_time'}
- ]
+ acp => [ {column => 'id', transform => 'count', aggregate => 1, alias => 'count'} ],
+ ccm => [ {column =>'avg_wait_time'} ]
},
- from => {ahcm => {acp => {join => 'ccm'}}},
- where => {'+ahcm' => {hold => $hold->id}}
+ from => {
+ ahcm => {
+ acp => {
+ join => {
+ ccm => {type => 'left'}
+ }
+ }
+ }
+ },
+ where => {'+ahcm' => {hold => $hold->id} }
});
-
- # take into account copies that have no circ modifier
- my $no_circ_mods = $e->json_query({
- select => {
- acp => [
- {column => 'id', transform => 'count', aggregate => 1, alias => 'count'}
- ]
- },
- from => {ahcm => 'acp'},
- where => {'+ahcm' => {hold => $hold->id}, '+acp' => {circ_modifier => undef}}
- })->[0];
-
- push(@$hold_data, {count => $no_circ_mods->{count}}) if $no_circ_mods;
-
my $user_org = $e->json_query({select => {au => ['home_ou']}, from => 'au', where => {id => $hold->usr}})->[0]->{home_ou};
my $default_wait = $U->ou_ancestor_setting_value($user_org, OILS_SETTING_HOLD_ESIMATE_WAIT_INTERVAL);
More information about the open-ils-commits
mailing list