@sis-cc/dotstatsuite-components 14.2.4 → 14.2.5

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.
@@ -53,7 +53,7 @@ var getUnitsArtefacts = exports.getUnitsArtefacts = function getUnitsArtefacts(_
53
53
  if (length === 0) {
54
54
  return acc;
55
55
  }
56
- if (R.path(['relationship', 'primaryMeasure'], attr) === 'OBS_VALUE') {
56
+ if (R.path(['relationship', 'primaryMeasure'], attr) === 'OBS_VALUE' || R.hasPath(['relationship', 'observation'], attr)) {
57
57
  return R.assocPath(['series', attr.id], (0, _extends3.default)({}, attr, { index: index, observations: true }), acc);
58
58
  }
59
59
  var attachedDimensions = R.path(['relationship', 'dimensions'], attr);
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@sis-cc/dotstatsuite-components",
3
3
  "description": "Set components based on React.",
4
- "version": "14.2.4",
4
+ "version": "14.2.5",
5
5
  "main": "lib/index.js",
6
6
  "author": "OECD",
7
7
  "license": "MIT",
@@ -54,7 +54,8 @@ export const getUnitsArtefacts = ({ unitsDefinitionCodes=[], data }) => {
54
54
  if (length === 0) {
55
55
  return acc;
56
56
  }
57
- if (R.path(['relationship', 'primaryMeasure'], attr) === 'OBS_VALUE') {
57
+ if ((R.path(['relationship', 'primaryMeasure'], attr) === 'OBS_VALUE')
58
+ || (R.hasPath(['relationship', 'observation'], attr))) {
58
59
  return R.assocPath(['series', attr.id], { ...attr, index, observations: true }, acc);
59
60
  }
60
61
  const attachedDimensions = R.path(['relationship', 'dimensions'], attr);
@@ -17,6 +17,7 @@ const data = {
17
17
  { id: 'A7', relationship: { dimensions: ['D1', 'D2'] }, values: [{ id: 'V1' }] },
18
18
  { id: 'A8', relationship: { primaryMeasure: 'OBS_VALUE' }, values: [{ id: 'V1' }, { id: 'V2' }] },
19
19
  { id: 'A9', relationship: { primaryMeasure: 'OBS_VALUE' }, values: [{ id: 'V1' }, { id: 'V2' }], display: false },
20
+ { id: 'A10', relationship: { observation: {} }, values: [{ id: 'V1' }, { id: 'V2' }] },
20
21
  ]
21
22
  },
22
23
  dimensions: {
@@ -109,4 +110,10 @@ describe('getUnitsArtefacts tests', () => {
109
110
  dimensions: { header: {}, series: {} },
110
111
  });
111
112
  });
113
+ it('observation relationship', () => {
114
+ expect(getUnitsArtefacts({ data: { data }, unitsDefinitionCodes: ['A9', 'A10'] })).to.deep.equal({
115
+ attributes: { header: {}, series: { A10: { id: 'A10', observations: true, index: 7, relationship: { observation: {} }, values: [{ id: 'V1' }, { id: 'V2' }] } } },
116
+ dimensions: { header: {}, series: {} },
117
+ });
118
+ });
112
119
  });