@sis-cc/dotstatsuite-components 17.25.0 → 17.26.0

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.
@@ -40,7 +40,7 @@ var parseAttributes = exports.parseAttributes = function parseAttributes(attribu
40
40
  }
41
41
  var seriesDimensions = R.pipe(R.pathOr([], ['relationship', 'dimensions']), R.filter(function (id) {
42
42
  var dimension = R.prop(id, indexedDimensions);
43
- return !dimension.header;
43
+ return !dimension.header && R.length(dimension.values || []) > 1;
44
44
  }))(attr);
45
45
  if (R.length(seriesDimensions) > 0) {
46
46
  return (0, _extends3.default)({}, res, { series: true, relationship: seriesDimensions });
@@ -61,7 +61,7 @@ var getCells = exports.getCells = function getCells(customAttributes, cellsAttri
61
61
  var attributesInCellsCombination = R.pipe(R.propOr([], 'cells'), R.pluck('concepts'), R.unnest)(combinations);
62
62
 
63
63
  var _customAttributes = R.over(R.lensProp('notes'), function (notes) {
64
- return R.concat(notes || [], attributesInLayoutCombination);
64
+ return R.pipe(R.concat, R.uniq)(notes || [], attributesInLayoutCombination);
65
65
  })(customAttributes);
66
66
 
67
67
  return R.mapObjIndexed(function (obs) {
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": "17.25.0",
4
+ "version": "17.26.0",
5
5
  "main": "lib/index.js",
6
6
  "author": "OECD",
7
7
  "license": "MIT",
@@ -25,7 +25,7 @@ export const parseAttributes = (attributes, dimensions, customAttributes) => {
25
25
  R.pathOr([], ['relationship', 'dimensions']),
26
26
  R.filter(id => {
27
27
  const dimension = R.prop(id, indexedDimensions);
28
- return !dimension.header;
28
+ return !dimension.header && R.length(dimension.values || []) > 1;
29
29
  }),
30
30
  )(attr);
31
31
  if (R.length(seriesDimensions) > 0) {
@@ -57,7 +57,7 @@ export const getCells = (customAttributes, cellsAttributesId, combinations, attr
57
57
 
58
58
  const _customAttributes = R.over(
59
59
  R.lensProp('notes'),
60
- notes => R.concat(notes || [], attributesInLayoutCombination)
60
+ notes => R.pipe(R.concat, R.uniq)(notes || [], attributesInLayoutCombination)
61
61
  )(customAttributes);
62
62
 
63
63
  return R.mapObjIndexed(
@@ -78,4 +78,41 @@ describe('getCells tests', () => {
78
78
  }
79
79
  });
80
80
  });
81
+ it('duplication between notes and combinations definitions', () => {
82
+ const _customAttributes = {
83
+ flags: [],
84
+ notes: ['A1', 'A2']
85
+ };
86
+
87
+ const combinations = {
88
+ cells: [],
89
+ layout: [{ id: 'LAYOUT_COMB', concepts: ['D1', 'A1'] }]
90
+ };
91
+
92
+ const attributesSeries = { 'D1=V0': {} };
93
+
94
+ const cellsAttributesIds = ['A2'];
95
+
96
+ const observations = {
97
+ 'obs': {
98
+ value: 'val',
99
+ formattedValue: 'val',
100
+ attributes: {
101
+ A1: { id: 'A1', value: { id: 'A1V' }, serieKey: 'D1=V0' },
102
+ A2: { id: 'A2', value: { id: 'A2V' } },
103
+ }
104
+ }
105
+ };
106
+ expect(getCells(_customAttributes, cellsAttributesIds, combinations, attributesSeries, [])(observations)).to.deep.equal({
107
+ 'obs': {
108
+ value: 'val',
109
+ intValue: null,
110
+ sideProps: null,
111
+ flags: [
112
+ { id: 'A1', value: { id: 'A1V' } },
113
+ { id: 'A2', value: { id: 'A2V' } }
114
+ ]
115
+ }
116
+ });
117
+ });
81
118
  });
@@ -7,6 +7,7 @@ const attributes = [
7
7
  { id: 'a9', relationship: { dimensions: ['d4'] }, values: [{ id: 'a9v1' }] }, // single 'many values' dimension relationship
8
8
  { id: 'a10', relationship: { dimensions: ['d1', 'd2'] }, values: [{ id: 'a10v1' }] }, // many 'single value' dimensions realtionship
9
9
  { id: 'a11', relationship: { dimensions: ['d1', 'd2', 'd4'] }, values: [{ id: 'a11v1' }] }, // one 'many values' and many 'single value' dimensions relationship
10
+ { id: 'a12', relationship: { dimensions: ['d4', 'd5', 'd7'] }, values: [{ id: 'a11v1' }] }, // exclude empty dimension from relationship
10
11
  ];
11
12
 
12
13
  const customAttributes = {};
@@ -18,6 +19,7 @@ const dimensions = [
18
19
  { id: 'd4', header: false, values: [{ id: 'v0' }, { id: 'v1' }] },
19
20
  { id: 'd5', header: false, values: [{ id: 'v0' }, { id: 'v1' }] },
20
21
  { id: 'd6', header: false, values: [{ id: 'v0' }, { id: 'v1' }] },
22
+ { id: 'd7', header: false, values: [] }
21
23
  ];
22
24
 
23
25
  describe('parseAttributes test', () => {
@@ -28,6 +30,7 @@ describe('parseAttributes test', () => {
28
30
  { id: 'a9', index: 2, relationship: ['d4'], series: true, values: [{ id: 'a9v1' }] },
29
31
  { id: 'a10', index: 3, relationship: ['d1', 'd2'], header: true, values: [{ id: 'a10v1' }] },
30
32
  { id: 'a11', index: 4, relationship: ['d4'], series: true, values: [{ id: 'a11v1' }] },
33
+ { id: 'a12', index: 5, relationship: ['d4', 'd5'], series: true, values: [{ id: 'a11v1' }] },
31
34
  ]);
32
35
  });
33
36
  });