Skip to content

Commit

Permalink
Fixed ObsGroup Payload for edited Obs.
Browse files Browse the repository at this point in the history
  • Loading branch information
Luis Oliveira committed Feb 19, 2024
1 parent e8a2695 commit 288b2e7
Showing 1 changed file with 8 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -490,12 +490,17 @@ export class ObsAdapterHelper {
const nodeAsGroup: GroupNode = node as GroupNode;

// Get existing obs
let childrenPayload = nodeAsGroup?.initialValue?.groupMembers?.map(node => this.getOldObsPayload(node)) || [];
let childrenPayload =
nodeAsGroup?.initialValue?.groupMembers?.map((node) =>
this.getOldObsPayload(node)
) || [];
_.each(nodeAsGroup.children, (child) => {
const payload = this.getObsNodePayload(child);
if (payload.length > 0) {
if (payload[0].voided) {
childrenPayload.find(obs => obs.uuid == payload[0].uuid).voided = true;
childrenPayload.find(
(obs) => obs.uuid == payload[0].uuid
).voided = true;
} else {
childrenPayload = childrenPayload.concat(payload);
}
Expand All @@ -508,7 +513,7 @@ export class ObsAdapterHelper {

const groupPayload: any = {
groupMembers: childrenPayload,
voided: childrenPayload?.every(member => member.voided === true)
voided: childrenPayload?.every((member) => member.voided === true)
};

if (nodeAsGroup.initialValue) {
Expand Down

0 comments on commit 288b2e7

Please sign in to comment.