[open-ils-commits] r17817 - trunk/Open-ILS/web/js/ui/default/circ/selfcheck (erickson)
svn at svn.open-ils.org
svn at svn.open-ils.org
Sun Sep 19 15:15:53 EDT 2010
Author: erickson
Date: 2010-09-19 15:15:48 -0400 (Sun, 19 Sep 2010)
New Revision: 17817
Modified:
trunk/Open-ILS/web/js/ui/default/circ/selfcheck/selfcheck.js
Log:
for large sets of holds, usually around 10 or more, the holds display takes a little too long. instead of collecting them all and sorting them by queue position, slot them into the display table (by queue position) as they arrive
Modified: trunk/Open-ILS/web/js/ui/default/circ/selfcheck/selfcheck.js
===================================================================
--- trunk/Open-ILS/web/js/ui/default/circ/selfcheck/selfcheck.js 2010-09-19 03:51:09 UTC (rev 17816)
+++ trunk/Open-ILS/web/js/ui/default/circ/selfcheck/selfcheck.js 2010-09-19 19:15:48 UTC (rev 17817)
@@ -678,12 +678,12 @@
}
fieldmapper.standardRequest( // fetch the hold objects with fleshed details
- ['open-ils.circ', 'open-ils.circ.hold.details.batch.retrieve.atomic'],
+ ['open-ils.circ', 'open-ils.circ.hold.details.batch.retrieve'],
{ async : true,
params : [self.authtoken, ids],
-
- oncomplete : function(rr) {
- self.drawHolds(openils.Util.readResponse(rr));
+ onresponse : function(rr) {
+ progressDialog.hide();
+ self.insertHold(openils.Util.readResponse(rr));
}
}
);
@@ -692,54 +692,45 @@
);
}
-/**
- * Fetch and add a single hold to the list of holds
- */
-SelfCheckManager.prototype.drawHolds = function(holds) {
+SelfCheckManager.prototype.insertHold = function(data) {
+ var row = this.holdTemplate.cloneNode(true);
- holds = holds.sort(
- // sort available holds to the top of the list
- // followed by queue position order
- function(a, b) {
- if(a.status == 4) return -1;
- if(a.queue_position < b.queue_position) return -1;
- return 1;
- }
- );
+ if(data.mvr.isbn()) {
+ this.byName(row, 'jacket').setAttribute('src', '/opac/extras/ac/jacket/small/' + data.mvr.isbn());
+ }
- this.holds = holds;
+ this.byName(row, 'title').innerHTML = data.mvr.title();
+ this.byName(row, 'author').innerHTML = data.mvr.author();
- progressDialog.hide();
+ if(data.status == 4) {
- for(var i in holds) {
+ // hold is ready for pickup
+ this.byName(row, 'status').innerHTML = localeStrings.HOLD_STATUS_READY;
- var data = holds[i];
- var row = this.holdTemplate.cloneNode(true);
+ } else {
- if(data.mvr.isbn()) {
- this.byName(row, 'jacket').setAttribute('src', '/opac/extras/ac/jacket/small/' + data.mvr.isbn());
- }
+ // hold is still pending
+ this.byName(row, 'status').innerHTML =
+ dojo.string.substitute(
+ localeStrings.HOLD_STATUS_WAITING,
+ [data.queue_position, data.potential_copies]
+ );
+ }
- this.byName(row, 'title').innerHTML = data.mvr.title();
- this.byName(row, 'author').innerHTML = data.mvr.author();
+ // find the correct place the table to slot in the hold based on queue position
- if(data.status == 4) {
+ var position = (data.status == 4) ? 0 : data.queue_position;
+ row.setAttribute('position', position);
- // hold is ready for pickup
- this.byName(row, 'status').innerHTML = localeStrings.HOLD_STATUS_READY;
-
- } else {
-
- // hold is still pending
- this.byName(row, 'status').innerHTML =
- dojo.string.substitute(
- localeStrings.HOLD_STATUS_WAITING,
- [data.queue_position, data.potential_copies]
- );
+ for(var i = 0; i < this.holdTbody.childNodes.length; i++) {
+ var node = this.holdTbody.childNodes[i];
+ if(Number(node.getAttribute('position')) >= position) {
+ this.holdTbody.insertBefore(row, node);
+ return;
}
-
- this.holdTbody.appendChild(row);
}
+
+ this.holdTbody.appendChild(row);
}
More information about the open-ils-commits
mailing list