Skip to content

Commit

Permalink
fix: [DHIS2-15102] assign data elements sequentially (#1852)
Browse files Browse the repository at this point in the history
  • Loading branch information
superskip committed Sep 8, 2023
1 parent 33e045d commit 2263e79
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 3 deletions.
6 changes: 3 additions & 3 deletions components/dataentry/dataentry-controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,8 @@ trackerCapture.controller('DataEntryController',
AuthorityService,
AccessUtils,
TCOrgUnitService,
UsersService) {
UsersService,
AssignmentQueue) {

//Unique instance id for the controller:
$scope.APIURL = DHIS2URL;
Expand Down Expand Up @@ -1752,7 +1753,7 @@ trackerCapture.controller('DataEntryController',
}
]
};
return DHIS2EventFactory.updateForSingleValue(ev).then(function (response) {
return AssignmentQueue.insertAssignment(() => DHIS2EventFactory.updateForSingleValue(ev)).then(function (response) {
if(!response) {
if(!backgroundUpdate) {
$scope.currentElement.saved = false;
Expand Down Expand Up @@ -1789,7 +1790,6 @@ trackerCapture.controller('DataEntryController',
}

});

}
};

Expand Down
8 changes: 8 additions & 0 deletions scripts/services.js
Original file line number Diff line number Diff line change
Expand Up @@ -3414,4 +3414,12 @@ var trackerCaptureServices = angular.module('trackerCaptureServices', ['ngResour
});
return promise;
}
})
.service('AssignmentQueue', function() {
var assignmentQueue = Promise.resolve();

this.insertAssignment = function(assignment) {
assignmentQueue = assignmentQueue.then(assignment, assignment);
return assignmentQueue;
}
});

0 comments on commit 2263e79

Please sign in to comment.