@sis-cc/dotstatsuite-components 17.29.0 → 17.30.1
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/rules/src/preparators/getReportingYearStart.js +1 -1
- package/lib/rules2/src/hasCellMetadata.js +3 -0
- package/lib/rules2/src/table/getTableLayoutIds.js +0 -1
- package/package.json +1 -1
- package/src/rules/src/preparators/getReportingYearStart.js +1 -1
- package/src/rules2/src/hasCellMetadata.js +3 -0
- package/src/rules2/src/table/getTableLayoutIds.js +0 -1
- package/test/getCells.test.js +43 -0
- package/test/getReportingYearStart.test.js +3 -3
|
@@ -39,7 +39,7 @@ var getReportingYearStart = exports.getReportingYearStart = function getReportin
|
|
|
39
39
|
|
|
40
40
|
return id === _constants.REPORTING_YEAR_START_DAY || id === _constants.REPYEARSTART;
|
|
41
41
|
}, attributes) || {};
|
|
42
|
-
var reportYearStart = R.pathOr('--01-01', ['values', 0, '
|
|
42
|
+
var reportYearStart = R.pathOr('--01-01', ['values', 0, 'value'], reportYearStartAttr);
|
|
43
43
|
|
|
44
44
|
var _R$match = R.match(/[\d]{2}/g, reportYearStart),
|
|
45
45
|
_R$match2 = (0, _slicedToArray3.default)(_R$match, 2),
|
|
@@ -12,6 +12,9 @@ var R = _interopRequireWildcard(_ramda);
|
|
|
12
12
|
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } }
|
|
13
13
|
|
|
14
14
|
var hasCellMetadata = exports.hasCellMetadata = function hasCellMetadata(metadataCoordinates, cellCoordinates) {
|
|
15
|
+
if (R.propOr('OBS_VALUE', 'OBS_ATTRIBUTES', cellCoordinates) !== 'OBS_VALUE') {
|
|
16
|
+
return false;
|
|
17
|
+
}
|
|
15
18
|
return R.pipe(R.find(function (coordinates) {
|
|
16
19
|
var mergedCoord = R.mergeLeft(coordinates, cellCoordinates);
|
|
17
20
|
return !R.isEmpty(coordinates) && R.equals(mergedCoord, cellCoordinates);
|
|
@@ -229,7 +229,6 @@ var injectRemainingDimensionsInLayout = exports.injectRemainingDimensionsInLayou
|
|
|
229
229
|
return !R.isNil(dimId);
|
|
230
230
|
}, _layout.rows);
|
|
231
231
|
|
|
232
|
-
console.log({ dimInRows: dimInRows, layoutIds: layoutIds, indexedCombinations: indexedCombinations, layoutDimsIds: layoutDimsIds });
|
|
233
232
|
if (R.isNil(dimInRows)) {
|
|
234
233
|
if (R.isEmpty(_remaining)) {
|
|
235
234
|
var toTakeIn = R.isEmpty(_layout.sections) ? 'header' : 'sections';
|
package/package.json
CHANGED
|
@@ -10,7 +10,7 @@ export const getReportingYearStart = (sdmxJson) => {
|
|
|
10
10
|
const reportYearStartAttr = R.find(({ id }) => {
|
|
11
11
|
return id === REPORTING_YEAR_START_DAY || id === REPYEARSTART;
|
|
12
12
|
}, attributes) || {};
|
|
13
|
-
const reportYearStart = R.pathOr('--01-01', ['values', 0, '
|
|
13
|
+
const reportYearStart = R.pathOr('--01-01', ['values', 0, 'value'], reportYearStartAttr);
|
|
14
14
|
const [month = '01', day = '01'] = R.match(/[\d]{2}/g, reportYearStart);
|
|
15
15
|
return ({ month, day });
|
|
16
16
|
};
|
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
import * as R from 'ramda';
|
|
2
2
|
|
|
3
3
|
export const hasCellMetadata = (metadataCoordinates, cellCoordinates) => {
|
|
4
|
+
if (R.propOr('OBS_VALUE', 'OBS_ATTRIBUTES', cellCoordinates) !== 'OBS_VALUE') {
|
|
5
|
+
return false;
|
|
6
|
+
}
|
|
4
7
|
return R.pipe(
|
|
5
8
|
R.find(coordinates => {
|
|
6
9
|
const mergedCoord = R.mergeLeft(coordinates, cellCoordinates);
|
|
@@ -166,7 +166,6 @@ export const injectRemainingDimensionsInLayout = (layoutIds, remainingDims, inde
|
|
|
166
166
|
return !R.isNil(dimId);
|
|
167
167
|
}, _layout.rows);
|
|
168
168
|
|
|
169
|
-
console.log({ dimInRows, layoutIds, indexedCombinations, layoutDimsIds });
|
|
170
169
|
if (R.isNil(dimInRows)) {
|
|
171
170
|
if (R.isEmpty(_remaining)) {
|
|
172
171
|
const toTakeIn = R.isEmpty(_layout.sections) ? 'header' : 'sections';
|
package/test/getCells.test.js
CHANGED
|
@@ -115,4 +115,47 @@ describe('getCells tests', () => {
|
|
|
115
115
|
}
|
|
116
116
|
});
|
|
117
117
|
});
|
|
118
|
+
it('metadata and OBS_ATTRIBUTES', () => {
|
|
119
|
+
const _customAttributes = {
|
|
120
|
+
flags: [],
|
|
121
|
+
notes: []
|
|
122
|
+
};
|
|
123
|
+
|
|
124
|
+
const combinations = {
|
|
125
|
+
cells: [],
|
|
126
|
+
layout: []
|
|
127
|
+
};
|
|
128
|
+
|
|
129
|
+
const observations = {
|
|
130
|
+
'a': {
|
|
131
|
+
value: 'val',
|
|
132
|
+
formattedValue: 'val',
|
|
133
|
+
attributes: {},
|
|
134
|
+
indexedDimValIds: { d0: 'v0', d1: 'v0', OBS_ATTRIBUTES: 'OBS_VALUE' }
|
|
135
|
+
},
|
|
136
|
+
'b': {
|
|
137
|
+
value: 'attr val',
|
|
138
|
+
formattedValue: 'attr val',
|
|
139
|
+
attributes: {},
|
|
140
|
+
indexedDimValIds: { d0: 'v0', d1: 'v0', OBS_ATTRIBUTES: 'A' }
|
|
141
|
+
}
|
|
142
|
+
};
|
|
143
|
+
const metadataCoordinates = [{ d0: 'v0', d1: 'v0' }];
|
|
144
|
+
expect(getCells(_customAttributes, {}, combinations, {}, metadataCoordinates)(observations)).to.deep.equal({
|
|
145
|
+
'a': {
|
|
146
|
+
value: 'val',
|
|
147
|
+
intValue: null,
|
|
148
|
+
indexedDimValIds: { d0: 'v0', d1: 'v0', OBS_ATTRIBUTES: 'OBS_VALUE' },
|
|
149
|
+
sideProps: { hasAdvancedAttributes: false, hasMetadata: true, coordinates: { d0: 'v0', d1: 'v0', OBS_ATTRIBUTES: 'OBS_VALUE' } },
|
|
150
|
+
flags: []
|
|
151
|
+
},
|
|
152
|
+
'b': {
|
|
153
|
+
value: 'attr val',
|
|
154
|
+
intValue: null,
|
|
155
|
+
indexedDimValIds: { d0: 'v0', d1: 'v0', OBS_ATTRIBUTES: 'A' },
|
|
156
|
+
sideProps: null,
|
|
157
|
+
flags: []
|
|
158
|
+
}
|
|
159
|
+
});
|
|
160
|
+
});
|
|
118
161
|
});
|
|
@@ -12,7 +12,7 @@ describe('getReportingYearStart tests', () => {
|
|
|
12
12
|
attributes: {
|
|
13
13
|
observation: [
|
|
14
14
|
{ "id": "REPYEARSTART",
|
|
15
|
-
"values": [{ "
|
|
15
|
+
"values": [{ "value": "0" }]
|
|
16
16
|
}
|
|
17
17
|
]
|
|
18
18
|
}
|
|
@@ -29,7 +29,7 @@ describe('getReportingYearStart tests', () => {
|
|
|
29
29
|
observation: [
|
|
30
30
|
{
|
|
31
31
|
"id": "REPORTING_YEAR_START_DAY",
|
|
32
|
-
"values": [{
|
|
32
|
+
"values": [{ "value": "--07-01" }]
|
|
33
33
|
}
|
|
34
34
|
]
|
|
35
35
|
}
|
|
@@ -47,7 +47,7 @@ describe('getReportingYearStart tests', () => {
|
|
|
47
47
|
observation: [
|
|
48
48
|
{
|
|
49
49
|
"id": "REPYEARSTART",
|
|
50
|
-
"values": [{
|
|
50
|
+
"values": [{ "value": "--08-09" }]
|
|
51
51
|
}
|
|
52
52
|
]
|
|
53
53
|
}
|