Skip to content

Commit

Permalink
avniproject/avni-client#1571 | Fix display of observations when the s…
Browse files Browse the repository at this point in the history
…ame concept is used both within a QuestionGroup and outside in the same FormElementGroup
  • Loading branch information
1t5j0y committed Jan 30, 2025
1 parent eaf34fe commit 9ec2c7e
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/application/Form.js
Original file line number Diff line number Diff line change
Expand Up @@ -321,11 +321,11 @@ class Form extends BaseEntity {
})
);
const orderedFormElements = _.sortBy(childFormElements, fe => fe.displayOrder);
_.forEach(orderedFormElements, (formElement) => this.addSortedObservations(formElement, observations, orderedChildObs));
_.forEach(orderedFormElements, (formElement) => this.addSortedObservations(formElement, observations, orderedChildObs, true));
return orderedChildObs;
}

addSortedObservations(formElement, observations, orderedObservations) {
addSortedObservations(formElement, observations, orderedObservations, forQGChildren = false) {
const concept = formElement.concept;
const foundObs = observations.find((obs) => obs.concept.uuid === concept.uuid);
if (!_.isNil(foundObs) && concept.isQuestionGroup()) {
Expand All @@ -340,7 +340,7 @@ class Form extends BaseEntity {
orderedObservations.push(clonedObs);
}
} else {
if (!_.isNil(foundObs)) {
if (!_.isNil(foundObs) && (_.isNil(formElement.groupUuid) || forQGChildren)) {
foundObs.styles = formElement.styles;
orderedObservations.push(foundObs);
}
Expand Down

0 comments on commit 9ec2c7e

Please sign in to comment.