Skip to content

Commit

Permalink
nit: rename clearConnectionLines and move remove disubursement layer out
Browse files Browse the repository at this point in the history
  • Loading branch information
ajeety4 committed Dec 11, 2024
1 parent 92d3564 commit 6249e58
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ hqDefine("geospatial/js/case_management", [
self.setBusy(false);
};

self.clearConnectionLines = function (cases) {
self.getCasesForDisbursement = function (cases) {
let caseData = [];
const hasSelectedCases = mapModel.hasSelectedCases();
cases.forEach(function (c) {
Expand All @@ -105,13 +105,13 @@ hqDefine("geospatial/js/case_management", [
});
}
});
mapModel.removeDisbursementLayer();
return caseData;
};

self.runCaseDisbursementAlgorithm = function (cases, users) {
self.setBusy(true);
const caseData = self.clearConnectionLines(cases);
mapModel.removeDisbursementLayer();
const caseData = self.getCasesForDisbursement(cases);

self.setDisbursementParameters = function (parameters) {
var parametersList = [
Expand Down
4 changes: 1 addition & 3 deletions corehq/apps/geospatial/static/geospatial/js/models.js
Original file line number Diff line number Diff line change
Expand Up @@ -1000,14 +1000,12 @@ hqDefine('geospatial/js/models', [

self.finishAssignment = function () {
let userCasesToConnect = {};
let casesToClear = [];
for (const caseItem of self.caseData) {
const userItem = self.mapModel.caseGroupsIndex[caseItem.assignedUserId];
const groupId = (userItem) ? userItem.groupId : null;
self.mapModel.caseGroupsIndex[caseItem.caseId].assignedUserId = caseItem.assignedUserId;
self.mapModel.caseGroupsIndex[caseItem.caseId].groupId = groupId;

casesToClear.push(caseItem.mapItem);
if (caseItem.assignedUserId) {
if (!userCasesToConnect[caseItem.assignedUserId]) {
userCasesToConnect[caseItem.assignedUserId] = [];
Expand All @@ -1016,7 +1014,7 @@ hqDefine('geospatial/js/models', [
}
}

self.disbursementModel.clearConnectionLines(casesToClear);
self.mapModel.removeDisbursementLayer();
let userToCasesList = [];
for (const userId in userCasesToConnect) {
const user = self.mapModel.caseGroupsIndex[userId].item;
Expand Down

0 comments on commit 6249e58

Please sign in to comment.