From: Bill Erickson Date: Thu, 25 Jan 2018 22:57:32 +0000 (-0500) Subject: LP#1745499 Patron bucket from file query consolidation X-Git-Url: https://old-git.evergreen-ils.org/?a=commitdiff_plain;h=b90b6eaca8ac1a23101cdd9f2752058408bc9a22;p=evergreen%2Fequinox.git LP#1745499 Patron bucket from file query consolidation Replace one-pcrud-call-per-barcode with a single (streaming) pcrud search call to fetch patron cards when using the barcode file upload option in the web staff pending patron bucket UI. This avoids spawning high number of pcrud processes. Signed-off-by: Bill Erickson Signed-off-by: Galen Charlton Signed-off-by: Jason Stephenson --- diff --git a/Open-ILS/web/js/ui/default/staff/circ/patron/bucket/app.js b/Open-ILS/web/js/ui/default/staff/circ/patron/bucket/app.js index 4c3e5ccd39..70025b5b62 100644 --- a/Open-ILS/web/js/ui/default/staff/circ/patron/bucket/app.js +++ b/Open-ILS/web/js/ui/default/staff/circ/patron/bucket/app.js @@ -220,24 +220,28 @@ function($scope, $routeParams, bucketSvc , egGridDataProvider, egCore , ngTo $scope.$watch('barcodesFromFile', function(newVal, oldVal) { if (newVal && newVal != oldVal) { - var promises = []; + var barcodes = []; // $scope.resetPendingList(); // ??? Add instead of replace angular.forEach(newVal.split(/\n/), function(line) { if (!line) return; // scrub any trailing spaces or commas from the barcode line = line.replace(/(.*?)($|\s.*|,.*)/,'$1'); - promises.push(egCore.pcrud.search( - 'ac', - {barcode : line}, - {} - ).then(null, null, function(card) { - bucketSvc.pendingList.push(card.usr()); - })); - }); + barcodes.push(line); - $q.all(promises).then(function () { - $scope.gridControls.setQuery({id : bucketSvc.pendingList}); }); + egCore.pcrud.search( + 'ac', + {barcode : barcodes}, + {} + ).then( + function() { + $scope.gridControls.setQuery({id : bucketSvc.pendingList}); + }, + null, + function(card) { + bucketSvc.pendingList.push(card.usr()); + } + ); } });