From 5f84ca7eb3f711ab935ae62e1cf7d1e65921d4a0 Mon Sep 17 00:00:00 2001 From: Bill Erickson Date: Tue, 6 Feb 2018 11:43:18 -0500 Subject: [PATCH] JBAS-1981 SCKO Total/session items out count Signed-off-by: Bill Erickson --- .../templates_kcls/circ/selfcheck/circ_page.tt2 | 8 +++++++- .../web/js/ui/kcls/circ/selfcheck/selfcheck.js | 24 ++++++++++++++++------ 2 files changed, 25 insertions(+), 7 deletions(-) diff --git a/KCLS/openils/var/templates_kcls/circ/selfcheck/circ_page.tt2 b/KCLS/openils/var/templates_kcls/circ/selfcheck/circ_page.tt2 index 8f551a4c4e..50c7301b40 100644 --- a/KCLS/openils/var/templates_kcls/circ/selfcheck/circ_page.tt2 +++ b/KCLS/openils/var/templates_kcls/circ/selfcheck/circ_page.tt2 @@ -1,6 +1,12 @@
-
+
+ + Now: + + All: +
+
diff --git a/Open-ILS/web/js/ui/kcls/circ/selfcheck/selfcheck.js b/Open-ILS/web/js/ui/kcls/circ/selfcheck/selfcheck.js index 30d71c629a..bd58b0393d 100644 --- a/Open-ILS/web/js/ui/kcls/circ/selfcheck/selfcheck.js +++ b/Open-ILS/web/js/ui/kcls/circ/selfcheck/selfcheck.js @@ -606,8 +606,7 @@ SelfCheckManager.prototype.drawItemsOutPage = function() { dojo.byId('scko-renewal-alerts').innerHTML = ''; // Reset items checked out in case it changed - this.circSummary = undefined; - this.updateCircSummary(); + this.updateCircSummary(false, true); if(!this.outTemplate) this.outTemplate = this.itemsOutTbody.removeChild(dojo.byId('oils-selfck-circ-out-row')); @@ -820,8 +819,12 @@ SelfCheckManager.prototype.updateHoldsSummary = function() { } -SelfCheckManager.prototype.updateCircSummary = function(increment) { - if(!this.circSummary) { +SelfCheckManager.prototype.updateCircSummary = function(increment, force) { + + if (!this.circSummary || force) { + + // Avoid clobbering the session counts so for on a force refresh + var sessionCount = this.circSummary ? this.circSummary.session : 0; var summary = fieldmapper.standardRequest( ['open-ils.actor', 'open-ils.actor.user.checked_out.count'], @@ -831,15 +834,24 @@ SelfCheckManager.prototype.updateCircSummary = function(increment) { this.circSummary = { total : Number(summary.out) + Number(summary.overdue), overdue : Number(summary.overdue), - session : 0 + session : sessionCount }; } - if(increment) { + if (increment) { // local checkout occurred. Add to the total and the session. this.circSummary.total += 1; this.circSummary.session += 1; + + console.log('incrementing circ totals total='+ + this.circSummary.total+'; session=' + this.circSummary.session); } + + dojo.byId('oils-selfck-circ-account-total') + .innerHTML = this.circSummary.total; + + dojo.byId('oils-selfck-circ-session-total') + .innerHTML = this.circSummary.session; } -- 2.11.0