openchs-models 1.31.96 → 1.31.98

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.
@@ -21,16 +21,19 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { de
21
21
 
22
22
  function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
23
23
 
24
- const clone = function (concept, valueJSON) {
24
+ const clone = function (concept, valueJSON, abnormal) {
25
25
  const observation = new Observation();
26
26
  observation.concept = concept;
27
27
  observation.valueJSON = valueJSON;
28
+ observation.abnormal = abnormal;
28
29
  return observation;
29
30
  };
30
31
 
31
32
  class Observation extends _PersistedObject.default {
32
33
  constructor(that = null) {
33
34
  super(that);
35
+
36
+ _defineProperty(this, "abnormal", void 0);
34
37
  }
35
38
 
36
39
  get concept() {
@@ -49,10 +52,11 @@ class Observation extends _PersistedObject.default {
49
52
  this.that.valueJSON = x;
50
53
  }
51
54
 
52
- static create(concept, value) {
55
+ static create(concept, value, abnormal = false) {
53
56
  const observation = new Observation();
54
57
  observation.concept = concept;
55
58
  observation.valueJSON = value;
59
+ observation.abnormal = abnormal;
56
60
  return observation;
57
61
  }
58
62
 
@@ -492,6 +492,8 @@ class ObservationsHolder {
492
492
 
493
493
  const oldValueIndex = _lodash.default.indexOf(answers, oldValue);
494
494
 
495
+ if (oldValueIndex < 0) return; // due to race condition the old value might have been removed
496
+
495
497
  const newAnswers = _lodash.default.reject(answers, answer => answer === oldValue);
496
498
 
497
499
  newAnswers.splice(oldValueIndex, 0, newValue);
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.31.96",
4
+ "version": "1.31.98",
5
5
  "private": false,
6
6
  "repository": {
7
7
  "type": "git",