Skip to content

Commit

Permalink
Use existing groups
Browse files Browse the repository at this point in the history
  • Loading branch information
kaapstorm committed Jun 28, 2024
1 parent 042bf8c commit b746e0d
Showing 1 changed file with 15 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -68,14 +68,21 @@ hqDefine("data_dictionary/js/data_dictionary", [

const setCaseProperties = function (groupData) {
for (let group of groupData) {
let groupObj = groupsViewModel(
self.name,
group.id,
group.name,
group.description,
group.deprecated,
self.changeSaveButton
);
let groupObj = _.find(self.groups(), function (g) {
return g.id === group.id;
});
if (!groupObj) {
groupObj = groupsViewModel(
self.name,
group.id,
group.name,
group.description,
group.deprecated,
self.changeSaveButton
);
groupObj.properties.subscribe(self.changeSaveButton);
self.groups.push(groupObj);
}

for (let prop of group.properties) {
const isGeoCaseProp = (self.geoCaseProp === prop.name && prop.data_type === 'gps');
Expand All @@ -94,8 +101,6 @@ hqDefine("data_dictionary/js/data_dictionary", [
);

Check warning on line 101 in corehq/apps/data_dictionary/static/data_dictionary/js/data_dictionary.js

View workflow job for this annotation

GitHub Actions / Lint Javascript

Expected indentation of 20 spaces but found 16
groupObj.properties.push(propObj);
}
groupObj.properties.subscribe(self.changeSaveButton);
self.groups.push(groupObj);
}
};

Expand Down

0 comments on commit b746e0d

Please sign in to comment.