LP#1932203: serialize requests on Edit Due Date in Items Out tab
authorJeff Davis <jeff.davis@bc.libraries.coop>
Thu, 21 Apr 2022 17:48:15 +0000 (10:48 -0700)
committerJason Stephenson <jason@sigio.com>
Tue, 28 Jun 2022 17:59:42 +0000 (13:59 -0400)
Signed-off-by: Jeff Davis <jeff.davis@bc.libraries.coop>
Signed-off-by: Jason Stephenson <jason@sigio.com>

Open-ILS/web/js/ui/default/staff/circ/patron/items_out.js

index eaf53f3..b2988c5 100644 (file)
@@ -354,11 +354,12 @@ function($scope , $q , $routeParams , $timeout , egCore , egUser , patronSvc ,
                     $scope.ok = function(args) {
                         var due = $scope.args.due_date.toISOString();
                         console.debug("applying due date of " + due);
+                        egProgressDialog.open();
 
-                        var promises = [];
+                        var promise = $q.when();
                         angular.forEach(items, function(circ) {
-                            promises.push(
-                                egCore.net.request(
+                            promise = promise.then(function() {
+                                return egCore.net.request(
                                     'open-ils.circ',
                                     'open-ils.circ.circulation.due_date.update',
                                     egCore.auth.token(), circ.id(), due
@@ -368,10 +369,11 @@ function($scope , $q , $routeParams , $timeout , egCore , egUser , patronSvc ,
                                     // date from the modified circulation.
                                     circ.due_date(new_circ.due_date());
                                 })
-                            );
+                            });
                         });
 
-                        $q.all(promises).then(function() {
+                        promise.finally(function() {
+                            egProgressDialog.close();
                             $uibModalInstance.close();
                             provider.refresh();
                         });