From d98954fba51cdce6e6c89b4aea3b29758eecfa64 Mon Sep 17 00:00:00 2001 From: Bill Erickson Date: Thu, 25 Jan 2018 17:57:32 -0500 Subject: [PATCH] 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 --- .../js/ui/default/staff/circ/patron/bucket/app.js | 26 +++++++++++++--------- 1 file changed, 15 insertions(+), 11 deletions(-) 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()); + } + ); } }); -- 2.11.0