Skip to content

Commit 7019510

Browse files
committed
BAH-4203 | Update save condition logic to save single object at a time
1 parent df15fc5 commit 7019510

File tree

1 file changed

+2
-12
lines changed

1 file changed

+2
-12
lines changed

ui/app/common/domain/services/conditionsService.js

Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,10 @@ angular.module('bahmni.common.domain')
1212
var existingConditions = _.filter(conditionsToBeSaved, function (condition) {
1313
return condition.uuid;
1414
});
15-
15+
conditionsToBeSaved = newConditions.length ? newConditions : existingConditions;
1616
var promises = [];
1717

18-
if (newConditions.length > 0) {
19-
_.forEach(newConditions, function (conditionToSave) {
18+
_.forEach(conditionsToBeSaved, function (conditionToSave) {
2019
var body = {
2120
patient: patientUuid,
2221
clinicalStatus: conditionToSave.status,
@@ -39,15 +38,6 @@ angular.module('bahmni.common.domain')
3938
});
4039

4140
return promises[promises.length - 1];
42-
}
43-
44-
return {
45-
then: function(callback) {
46-
if (callback) callback({ data: existingConditions });
47-
return this;
48-
},
49-
catch: function() { return this; }
50-
};
5141
};
5242
this.getConditionHistory = function (patientUuid) {
5343
var params = {

0 commit comments

Comments
 (0)