@sis-cc/dotstatsuite-components 19.2.0 → 19.3.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.
- package/lib/rules2/src/getAttributesSeries.js +1 -1
- package/lib/rules2/src/table/getCells.js +8 -2
- package/package.json +1 -1
- package/src/rules2/src/getAttributesSeries.js +1 -1
- package/src/rules2/src/table/getCells.js +10 -4
- package/test/getAttributesSeries.test.js +6 -0
- package/test/getCells.test.js +20 -3
|
@@ -18,7 +18,7 @@ var getAttributesSeries = exports.getAttributesSeries = function getAttributesSe
|
|
|
18
18
|
var res = acc.res;
|
|
19
19
|
var rejected = acc.rejected;
|
|
20
20
|
R.forEachObjIndexed(function (attribute) {
|
|
21
|
-
if (!R.isNil(attribute.serieKey)) {
|
|
21
|
+
if (!R.isNil(attribute.serieKey) && !attribute.isObs) {
|
|
22
22
|
if (R.isNil(attribute.value)) {
|
|
23
23
|
res = R.dissocPath([attribute.serieKey, attribute.id], res);
|
|
24
24
|
rejected = R.assocPath([attribute.serieKey, attribute.id], true, rejected);
|
|
@@ -69,13 +69,19 @@ var getCells = exports.getCells = function getCells(customAttributes, cellsAttri
|
|
|
69
69
|
var relevantAttributes = isAttrCell ? [] : getCellRelevantAttributes(obs.attributes, attributesSeries, cellsAttributesId);
|
|
70
70
|
var flagsAndNotes = isAttrCell ? [] : (0, _getFlagsAndNotes.getFlagsAndNotes)(R.omit(attributesInCellsCombination, relevantAttributes), _customAttributes);
|
|
71
71
|
var combinedSeries = isAttrCell ? [] : getCellCombinedSeries(relevantAttributes, combinations.cells || []);
|
|
72
|
-
var hasAdvancedAttributes = isAttrCell ? false : R.pipe(R.omit(R.unnest([_customAttributes.flags || [], _customAttributes.notes || [], attributesInCellsCombination])),
|
|
72
|
+
var hasAdvancedAttributes = isAttrCell ? false : R.pipe(R.omit(R.unnest([_customAttributes.flags || [], _customAttributes.notes || [], attributesInCellsCombination])), function (res) {
|
|
73
|
+
return !R.isEmpty(res);
|
|
74
|
+
})(relevantAttributes);
|
|
75
|
+
|
|
76
|
+
var advancedAttributes = R.omit(R.unnest([_customAttributes.flags || [], _customAttributes.notes || [], attributesInCellsCombination]), R.filter(function (attr) {
|
|
77
|
+
return !R.isNil(attr.value);
|
|
78
|
+
}, obs.attributes));
|
|
73
79
|
|
|
74
80
|
var hasMetadata = isAttrCell ? false : (0, _hasCellMetadata.hasCellMetadata)(metadataCoordinates, obs.indexedDimValIds);
|
|
75
81
|
|
|
76
82
|
return (0, _extends3.default)({}, R.pick(['indexedDimValIds', 'key'], obs), {
|
|
77
83
|
flags: R.concat(flagsAndNotes, combinedSeries),
|
|
78
|
-
sideProps: hasAdvancedAttributes || hasMetadata ? {
|
|
84
|
+
sideProps: hasAdvancedAttributes || hasMetadata ? { hasMetadata: hasMetadata, coordinates: obs.indexedDimValIds, advancedAttributes: advancedAttributes } : null,
|
|
79
85
|
intValue: R.is(Number, obs.value) ? obs.value : null,
|
|
80
86
|
value: obs.formattedValue
|
|
81
87
|
});
|
package/package.json
CHANGED
|
@@ -8,7 +8,7 @@ export const getAttributesSeries = observations => R.pipe(
|
|
|
8
8
|
let rejected = acc.rejected;
|
|
9
9
|
R.forEachObjIndexed(
|
|
10
10
|
(attribute) => {
|
|
11
|
-
if (!R.isNil(attribute.serieKey)) {
|
|
11
|
+
if (!R.isNil(attribute.serieKey) && !attribute.isObs) {
|
|
12
12
|
if (R.isNil(attribute.value)) {
|
|
13
13
|
res = R.dissocPath([attribute.serieKey, attribute.id], res);
|
|
14
14
|
rejected = R.assocPath([attribute.serieKey, attribute.id], true, rejected);
|
|
@@ -66,18 +66,24 @@ export const getCells = (customAttributes, cellsAttributesId, combinations, attr
|
|
|
66
66
|
const relevantAttributes = isAttrCell ? [] : getCellRelevantAttributes(obs.attributes, attributesSeries, cellsAttributesId);
|
|
67
67
|
const flagsAndNotes = isAttrCell ? [] : getFlagsAndNotes(R.omit(attributesInCellsCombination, relevantAttributes), _customAttributes);
|
|
68
68
|
const combinedSeries = isAttrCell ? [] : getCellCombinedSeries(relevantAttributes, combinations.cells || []);
|
|
69
|
-
const hasAdvancedAttributes = isAttrCell
|
|
69
|
+
const hasAdvancedAttributes = isAttrCell
|
|
70
|
+
? false : R.pipe(
|
|
70
71
|
R.omit(R.unnest([_customAttributes.flags || [], _customAttributes.notes || [], attributesInCellsCombination])),
|
|
71
|
-
R.isEmpty
|
|
72
|
-
R.not
|
|
72
|
+
res => !R.isEmpty(res)
|
|
73
73
|
)(relevantAttributes);
|
|
74
74
|
|
|
75
|
+
const advancedAttributes = R.omit(
|
|
76
|
+
R.unnest([_customAttributes.flags || [], _customAttributes.notes || [], attributesInCellsCombination]),
|
|
77
|
+
R.filter(attr => !R.isNil(attr.value), obs.attributes),
|
|
78
|
+
);
|
|
79
|
+
|
|
75
80
|
const hasMetadata = isAttrCell ? false : hasCellMetadata(metadataCoordinates, obs.indexedDimValIds);
|
|
76
81
|
|
|
77
82
|
return ({
|
|
78
83
|
...R.pick(['indexedDimValIds', 'key'], obs),
|
|
79
84
|
flags: R.concat(flagsAndNotes, combinedSeries),
|
|
80
|
-
sideProps: hasAdvancedAttributes || hasMetadata
|
|
85
|
+
sideProps: hasAdvancedAttributes || hasMetadata
|
|
86
|
+
? { hasMetadata, coordinates: obs.indexedDimValIds, advancedAttributes } : null,
|
|
81
87
|
intValue: R.is(Number, obs.value) ? obs.value : null,
|
|
82
88
|
value: obs.formattedValue,
|
|
83
89
|
});
|
|
@@ -9,30 +9,35 @@ describe('getAttributesSeries tests', () => {
|
|
|
9
9
|
A: { id: 'A', value: { id: 'A0' }, serieKey: 'd0=v0' },
|
|
10
10
|
B: { id: 'B', value: { id: 'B0' }, serieKey: 'd1=v0' },
|
|
11
11
|
C: { id: 'C', value: null, serieKey: 'd2=v0' },
|
|
12
|
+
D: { id: 'D', value: { id: 'D0' }, serieKey: 'd2=v0', isObs: true }
|
|
12
13
|
}
|
|
13
14
|
},
|
|
14
15
|
b: {
|
|
15
16
|
attributes: {
|
|
16
17
|
A: { id: 'A', value: { id: 'A0' }, serieKey: 'd0=v0' },
|
|
17
18
|
B: { id: 'B', value: { id: 'B1' }, serieKey: 'd1=v0' },
|
|
19
|
+
D: { id: 'D', value: { id: 'D0' }, serieKey: 'd2=v0', isObs: true }
|
|
18
20
|
}
|
|
19
21
|
},
|
|
20
22
|
c: {
|
|
21
23
|
attributes: {
|
|
22
24
|
A: { id: 'A', value: { id: 'A0' }, serieKey: 'd0=v0' },
|
|
23
25
|
B: { id: 'B', value: { id: 'B1' }, serieKey: 'd1=v1' },
|
|
26
|
+
D: { id: 'D', value: { id: 'D0' }, serieKey: 'd2=v0', isObs: true }
|
|
24
27
|
}
|
|
25
28
|
},
|
|
26
29
|
d: {
|
|
27
30
|
attributes: {
|
|
28
31
|
A: { id: 'A', value: { id: 'A0' }, serieKey: 'd0=v0' },
|
|
29
32
|
B: { id: 'B', value: { id: 'B1' }, serieKey: 'd1=v1' },
|
|
33
|
+
D: { id: 'D', value: { id: 'D0' }, serieKey: 'd2=v0', isObs: true }
|
|
30
34
|
}
|
|
31
35
|
},
|
|
32
36
|
e: {
|
|
33
37
|
attributes: {
|
|
34
38
|
A: { id: 'A', value: { id: 'A0' }, serieKey: 'd0=v0' },
|
|
35
39
|
B: { id: 'B', value: { id: 'B3' }, serieKey: 'd1=v2' },
|
|
40
|
+
D: { id: 'D', value: { id: 'D0' }, serieKey: 'd2=v0', isObs: true }
|
|
36
41
|
}
|
|
37
42
|
},
|
|
38
43
|
f: {
|
|
@@ -40,6 +45,7 @@ describe('getAttributesSeries tests', () => {
|
|
|
40
45
|
A: { id: 'A', value: { id: 'A0' }, serieKey: 'd0=v0' },
|
|
41
46
|
B: { id: 'B', value: { id: 'B3' }, serieKey: 'd1=v2' },
|
|
42
47
|
C: { id: 'C', value: { id: 'C0' }, serieKey: 'd2=v0' },
|
|
48
|
+
D: { id: 'D', value: { id: 'D0' }, serieKey: 'd2=v0', isObs: true }
|
|
43
49
|
}
|
|
44
50
|
}
|
|
45
51
|
};
|
package/test/getCells.test.js
CHANGED
|
@@ -138,7 +138,13 @@ describe('getCells tests', () => {
|
|
|
138
138
|
formattedValue: 'attr val',
|
|
139
139
|
attributes: {},
|
|
140
140
|
indexedDimValIds: { d0: 'v0', d1: 'v0', OBS_ATTRIBUTES: 'A' }
|
|
141
|
-
}
|
|
141
|
+
},
|
|
142
|
+
'c': {
|
|
143
|
+
value: 'val',
|
|
144
|
+
formattedValue: 'val',
|
|
145
|
+
attributes: { ADV_ATTR: { id: 'ADV_ATTR', value: { id: 'v' } } },
|
|
146
|
+
indexedDimValIds: { d0: 'v1', d1: 'v0', OBS_ATTRIBUTES: 'OBS_VALUE' }
|
|
147
|
+
},
|
|
142
148
|
};
|
|
143
149
|
const metadataCoordinates = [{ d0: 'v0', d1: 'v0' }];
|
|
144
150
|
expect(getCells(_customAttributes, {}, combinations, {}, metadataCoordinates)(observations)).to.deep.equal({
|
|
@@ -146,7 +152,7 @@ describe('getCells tests', () => {
|
|
|
146
152
|
value: 'val',
|
|
147
153
|
intValue: null,
|
|
148
154
|
indexedDimValIds: { d0: 'v0', d1: 'v0', OBS_ATTRIBUTES: 'OBS_VALUE' },
|
|
149
|
-
sideProps: {
|
|
155
|
+
sideProps: { advancedAttributes: {}, hasMetadata: true, coordinates: { d0: 'v0', d1: 'v0', OBS_ATTRIBUTES: 'OBS_VALUE' } },
|
|
150
156
|
flags: []
|
|
151
157
|
},
|
|
152
158
|
'b': {
|
|
@@ -155,7 +161,18 @@ describe('getCells tests', () => {
|
|
|
155
161
|
indexedDimValIds: { d0: 'v0', d1: 'v0', OBS_ATTRIBUTES: 'A' },
|
|
156
162
|
sideProps: null,
|
|
157
163
|
flags: []
|
|
158
|
-
}
|
|
164
|
+
},
|
|
165
|
+
'c': {
|
|
166
|
+
value: 'val',
|
|
167
|
+
intValue: null,
|
|
168
|
+
indexedDimValIds: { d0: 'v1', d1: 'v0', OBS_ATTRIBUTES: 'OBS_VALUE' },
|
|
169
|
+
flags: [],
|
|
170
|
+
sideProps: {
|
|
171
|
+
advancedAttributes: { ADV_ATTR: { id: 'ADV_ATTR', value: { id: 'v' } } },
|
|
172
|
+
hasMetadata: false,
|
|
173
|
+
coordinates: { d0: 'v1', d1: 'v0', OBS_ATTRIBUTES: 'OBS_VALUE' }
|
|
174
|
+
},
|
|
175
|
+
},
|
|
159
176
|
});
|
|
160
177
|
});
|
|
161
178
|
});
|