Skip to content

Commit

Permalink
#1239 | Allow nil observations to be updated by form element status rule
Browse files Browse the repository at this point in the history
  • Loading branch information
1t5j0y committed Dec 20, 2023
1 parent 7460542 commit 81cd2da
Showing 1 changed file with 6 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ class ObservationsHolderActions {
const hiddenFormElementStatus = _.filter(formElementStatuses, (form) => form.visibility === false);
newState.observationsHolder.updatePrimitiveCodedObs(_.filter(newState.filteredFormElements, (fe) => {
const observation = newState.observationsHolder.findObservation(fe.concept);
return !(_.isNil(observation) || observation.valueJSON.answerSource === Observation.AnswerSource.Manual);
return _.isNil(observation) || observation.valueJSON.answerSource !== Observation.AnswerSource.Manual;
}), formElementStatuses);
newState.removeHiddenFormValidationResults(hiddenFormElementStatus);
let validationResult = action.formElement.validate(value);
Expand Down Expand Up @@ -92,7 +92,7 @@ class ObservationsHolderActions {
const hiddenFormElementStatus = _.filter(formElementStatuses, (form) => form.visibility === false);
newState.observationsHolder.updatePrimitiveCodedObs(_.filter(newState.filteredFormElements, (fe) => {
const observation = newState.observationsHolder.findObservation(fe.concept);
return !(_.isNil(observation) || observation.valueJSON.answerSource === Observation.AnswerSource.Manual);
return _.isNil(observation) || observation.valueJSON.answerSource !== Observation.AnswerSource.Manual;
}), formElementStatuses);
const validationResult = action.formElement.validate(_.isNil(observation) ? null : observation.getValueWrapper());
newState.handleValidationResults(ObservationsHolderActions.addPreviousValidationErrors(ruleValidationErrors, validationResult, newState.validationResults), context);
Expand All @@ -118,7 +118,7 @@ class ObservationsHolderActions {
const validationResult = action.formElement.validate(_.isNil(observation) ? null : observation.getValueWrapper());
newState.observationsHolder.updatePrimitiveCodedObs(_.filter(newState.filteredFormElements, (fe) => {
const observation = newState.observationsHolder.findObservation(fe.concept);
return !(_.isNil(observation) || observation.valueJSON.answerSource === Observation.AnswerSource.Manual);
return _.isNil(observation) || observation.valueJSON.answerSource !== Observation.AnswerSource.Manual;
}), formElementStatuses);
newState.handleValidationResults(ObservationsHolderActions.addPreviousValidationErrors(ruleValidationErrors, validationResult, newState.validationResults), context);
newState.removeHiddenFormValidationResults(hiddenFormElementStatus);
Expand All @@ -141,7 +141,7 @@ class ObservationsHolderActions {
const hiddenFormElementStatus = _.filter(formElementStatuses, (form) => form.visibility === false);
newState.observationsHolder.updatePrimitiveCodedObs(_.filter(newState.filteredFormElements, (fe) => {
const observation = newState.observationsHolder.findObservation(fe.concept);
return !(_.isNil(observation) || observation.valueJSON.answerSource === Observation.AnswerSource.Manual);
return _.isNil(observation) || observation.valueJSON.answerSource !== Observation.AnswerSource.Manual;
}), formElementStatuses);
const validationResult = action.formElement.validate(dateValue);
newState.handleValidationResults(ObservationsHolderActions.addPreviousValidationErrors(ruleValidationErrors, validationResult, newState.validationResults), context);
Expand All @@ -159,7 +159,7 @@ class ObservationsHolderActions {
const hiddenFormElementStatus = _.filter(formElementStatuses, (form) => form.visibility === false);
newState.observationsHolder.updatePrimitiveCodedObs(_.filter(newState.filteredFormElements, (fe) => {
const observation = newState.observationsHolder.findObservation(fe.concept);
return !(_.isNil(observation) || observation.valueJSON.answerSource === Observation.AnswerSource.Manual);
return _.isNil(observation) || observation.valueJSON.answerSource !== Observation.AnswerSource.Manual;
}), formElementStatuses);
const validationResult = action.formElement.validate(_.isNil(observation) ? null : observation.getValueWrapper());
newState.handleValidationResults(ObservationsHolderActions.addPreviousValidationErrors(ruleValidationErrors, validationResult, newState.validationResults), context);
Expand All @@ -175,7 +175,7 @@ class ObservationsHolderActions {
const hiddenFormElementStatus = _.filter(formElementStatuses, (form) => form.visibility === false);
newState.observationsHolder.updatePrimitiveCodedObs(_.filter(newState.filteredFormElements, (fe) => {
const observation = newState.observationsHolder.findObservation(fe.concept);
return !(_.isNil(observation) || observation.valueJSON.answerSource === Observation.AnswerSource.Manual);
return _.isNil(observation) || observation.valueJSON.answerSource !== Observation.AnswerSource.Manual;
}), formElementStatuses);
const value = _.isNil(observation) ? null : observation.getValueWrapper().getValue();
let validationResult = action.formElement.validate(value);
Expand Down

0 comments on commit 81cd2da

Please sign in to comment.