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=e8c27cb28cad4ac2fb5e9dd8c535a42bcb30fab1;p=Evergreen.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 0e8545ca94..92fbc570b1 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 @@ -216,24 +216,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()); + } + ); } });