openchs-models 1.33.67 → 1.33.68

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -419,8 +419,12 @@ class ObservationsHolder {
419
419
  // Handle multiple coded values
420
420
  else if (valueWrapper.isMultipleCoded) {
421
421
  const answers = valueWrapper.getValue();
422
- if (_lodash.default.includes(answers, oldValue)) {
423
- const newAnswers = _lodash.default.map(answers, answer => answer === oldValue ? newValue : answer);
422
+ const oldValueIndex = _lodash.default.indexOf(answers, oldValue);
423
+ if (oldValueIndex >= 0) {
424
+ // Duplicate occurrences are not meaningful for media values — collapse them
425
+ // into the single replaced entry.
426
+ const newAnswers = _lodash.default.reject(answers, answer => answer === oldValue);
427
+ newAnswers.splice(oldValueIndex, 0, newValue);
424
428
  observation.valueJSON = new _MultipleCodedValues.default(newAnswers, valueWrapper.answerSource);
425
429
  return true;
426
430
  }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "openchs-models",
3
3
  "description": "OpenCHS data model to be used by front end clients",
4
- "version": "1.33.67",
4
+ "version": "1.33.68",
5
5
  "private": false,
6
6
  "repository": {
7
7
  "type": "git",