[open-ils-commits] r11133 - in trunk/Open-ILS/src/perlmods/OpenILS: . Application/Circ
svn at svn.open-ils.org
svn at svn.open-ils.org
Tue Nov 11 12:04:05 EST 2008
Author: erickson
Date: 2008-11-11 12:04:03 -0500 (Tue, 11 Nov 2008)
New Revision: 11133
Modified:
trunk/Open-ILS/src/perlmods/OpenILS/Application/Circ/Holds.pm
trunk/Open-ILS/src/perlmods/OpenILS/Const.pm
Log:
plugged in simplistic hold wait estimate based on configured default wait estimate
Modified: trunk/Open-ILS/src/perlmods/OpenILS/Application/Circ/Holds.pm
===================================================================
--- trunk/Open-ILS/src/perlmods/OpenILS/Application/Circ/Holds.pm 2008-11-11 17:00:19 UTC (rev 11132)
+++ trunk/Open-ILS/src/perlmods/OpenILS/Application/Circ/Holds.pm 2008-11-11 17:04:03 UTC (rev 11133)
@@ -685,26 +685,32 @@
{ target => $hold->target,
hold_type => $hold->hold_type,
cancel_time => undef,
- fulfillment_time => undef
+ capture_time => undef
},
{order_by => {ahr => 'request_time asc'}}
],
{idlist => 1}
);
- my $pos = 0;
+ my $qpos = 0;
for my $hid (@$hold_ids) {
- $pos++;
+ $qpos++;
last if $hid == $hold->id;
}
my $potentials = $e->search_action_hold_copy_map({hold => $hold->id}, {idlist => 1});
+ my $num_potentials = scalar(@$potentials);
+ my $user_org = $e->json_query({select => {au => 'home_ou'}, from => 'au', where => {id => $hold->usr}})->[0]->{home_ou};
+ my $default_hold_interval = $U->ou_ancestor_setting_value($user_org, OILS_SETTING_HOLD_ESIMATE_WAIT_INTERVAL);
+ my $estimated_wait = $qpos * ($default_hold_interval / $num_potentials) if $default_hold_interval;
+
return {
total_holds => scalar(@$hold_ids),
- queue_position => $pos,
- potential_copies => scalar(@$potentials),
- status => _hold_status($e, $hold)
+ queue_position => $qpos,
+ potential_copies => $num_potentials,
+ status => _hold_status($e, $hold),
+ estimated_wait => int($estimated_wait)
};
}
Modified: trunk/Open-ILS/src/perlmods/OpenILS/Const.pm
===================================================================
--- trunk/Open-ILS/src/perlmods/OpenILS/Const.pm 2008-11-11 17:00:19 UTC (rev 11132)
+++ trunk/Open-ILS/src/perlmods/OpenILS/Const.pm 2008-11-11 17:04:03 UTC (rev 11133)
@@ -82,6 +82,7 @@
econst OILS_SETTING_HOLD_SOFT_BOUNDARY => 'circ.hold_boundary.soft';
econst OILS_SETTING_HOLD_HARD_BOUNDARY => 'circ.hold_boundary.hard';
econst OILS_SETTING_HOLD_EXPIRE => 'circ.hold_expire_interval';
+econst OILS_SETTING_HOLD_ESIMATE_WAIT_INTERVAL => 'circ.hold_estimate_wait_interval';
More information about the open-ils-commits
mailing list