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
|
-
|
|
423
|
-
|
|
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
|
}
|