Skip to content

Commit

Permalink
Revert "#1294 | Use the addressLevel realmDb model entity as is for c…
Browse files Browse the repository at this point in the history
…apturing address for subject/person/groupSubject/family registration"

This reverts commit 09f2da7.
  • Loading branch information
himeshr committed Feb 19, 2024
1 parent 22911fb commit 672946e
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions packages/openchs-android/src/action/common/AddressLevelsState.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,17 @@ import _ from 'lodash';
class AddressLevelsState {
constructor(levels = []) {
const unsortedLevels = Object.entries(_.uniqBy(levels, l => l.uuid)
.reduce((acc, addrLevel) => {
addrLevel.isSelected = addrLevel.isSelected || false;
acc[addrLevel.type] = _.defaultTo(acc[addrLevel.type], []).concat([addrLevel]);
.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
}]);
return acc;
}, {}));
this.levels = unsortedLevels.map(([levelType, levels]) => {
Expand Down

0 comments on commit 672946e

Please sign in to comment.