Skip to content

Commit

Permalink
#1294 | Use the addressLevel realmDb model entity as is for capturing…
Browse files Browse the repository at this point in the history
… address for subject/person/groupSubject/family registration
  • Loading branch information
himeshr committed Feb 13, 2024
1 parent 8bcb3e1 commit 09f2da7
Showing 1 changed file with 3 additions and 11 deletions.
14 changes: 3 additions & 11 deletions packages/openchs-android/src/action/common/AddressLevelsState.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,9 @@ import _ from 'lodash';
class AddressLevelsState {
constructor(levels = []) {
const unsortedLevels = Object.entries(_.uniqBy(levels, l => l.uuid)
.reduce((acc, {locationMappings, uuid, name, level, type, parentUuid, typeUuid, isSelected = false}) => {
acc[type] = _.defaultTo(acc[type], []).concat([{
uuid,
name,
level,
type,
parentUuid,
typeUuid,
isSelected,
locationMappings
}]);
.reduce((acc, addrLevel) => {
addrLevel.isSelected = addrLevel.isSelected || false;
acc[addrLevel.type] = _.defaultTo(acc[addrLevel.type], []).concat([addrLevel]);
return acc;
}, {}));
this.levels = unsortedLevels.map(([levelType, levels]) => {
Expand Down

0 comments on commit 09f2da7

Please sign in to comment.