@sis-cc/dotstatsuite-components 15.0.12 → 15.0.14
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/date.js
CHANGED
|
@@ -129,7 +129,6 @@ var getReportedTimePeriod = exports.getReportedTimePeriod = function getReported
|
|
|
129
129
|
if (reportYearStart.month === '01' && reportYearStart.day === '01') {
|
|
130
130
|
return { start: start, end: end };
|
|
131
131
|
}
|
|
132
|
-
start = _dateFns2.default.addMinutes(start, start.getTimezoneOffset());
|
|
133
132
|
start = _dateFns2.default.addMonths(start, reportYearStart.month - 1);
|
|
134
133
|
start = _dateFns2.default.addDays(start, reportYearStart.day - 1);
|
|
135
134
|
if (freq === 'A') {
|
|
@@ -63,8 +63,9 @@ var getSidebarData = exports.getSidebarData = function getSidebarData(attributes
|
|
|
63
63
|
return (0, _extends3.default)({}, acc, { split: R.append('', acc.split) });
|
|
64
64
|
}
|
|
65
65
|
var dim = R.nth(dimIndex, dimensions);
|
|
66
|
-
var
|
|
67
|
-
|
|
66
|
+
var values = R.propOr([], 'values', dim || {});
|
|
67
|
+
var value = R.nth(Number(valIndex), values);
|
|
68
|
+
if (!value || !R.propOr(true, 'display', dim) || !R.propOr(true, 'display', value)) {
|
|
68
69
|
return (0, _extends3.default)({}, acc, { split: R.append('', acc.split) });
|
|
69
70
|
}
|
|
70
71
|
var dimLabel = dimensionValueDisplay(options.display)(dim);
|
package/package.json
CHANGED
package/src/rules/src/date.js
CHANGED
|
@@ -65,7 +65,6 @@ export const getReportedTimePeriod = (reportYearStart, value, freq) => {
|
|
|
65
65
|
if(reportYearStart.month === '01' && reportYearStart.day === '01') {
|
|
66
66
|
return ({ start, end });
|
|
67
67
|
}
|
|
68
|
-
start = dateFns.addMinutes(start, start.getTimezoneOffset());
|
|
69
68
|
start = dateFns.addMonths(start, reportYearStart.month - 1);
|
|
70
69
|
start = dateFns.addDays(start, reportYearStart.day - 1);
|
|
71
70
|
if (freq === 'A') {
|
|
@@ -48,8 +48,9 @@ export const getSidebarData = (attributesSeries, metadataSeries, dataflow, dimen
|
|
|
48
48
|
return ({ ...acc, split: R.append('', acc.split) });
|
|
49
49
|
}
|
|
50
50
|
const dim = R.nth(dimIndex, dimensions);
|
|
51
|
-
const
|
|
52
|
-
|
|
51
|
+
const values = R.propOr([], 'values', dim || {});
|
|
52
|
+
const value = R.nth(Number(valIndex), values);
|
|
53
|
+
if (!value || !R.propOr(true, 'display', dim) || !R.propOr(true, 'display', value)) {
|
|
53
54
|
return ({ ...acc, split: R.append('', acc.split) });
|
|
54
55
|
}
|
|
55
56
|
const dimLabel = dimensionValueDisplay(options.display)(dim);
|
|
@@ -113,6 +113,108 @@ describe('getSidebarData tests', () => {
|
|
|
113
113
|
}
|
|
114
114
|
]);
|
|
115
115
|
});
|
|
116
|
+
it('discordadnce between dimensions and metadata case', () => {
|
|
117
|
+
const attributes = {
|
|
118
|
+
'::': [
|
|
119
|
+
{ id: 'aa0', label: 'advanced attribute 0', value: 'value' },
|
|
120
|
+
{ id: 'aa1', label: 'advanced attribute 1', value: 'value' },
|
|
121
|
+
],
|
|
122
|
+
'0::': [
|
|
123
|
+
{ id: 'aa2', label: 'advanced attribute 2', value: 'value' },
|
|
124
|
+
{ id: 'aa3', label: 'advanced attribute 3', value: 'value' },
|
|
125
|
+
]
|
|
126
|
+
};
|
|
127
|
+
const metadata = {
|
|
128
|
+
'0::': [
|
|
129
|
+
{ id: 'ma0', label: 'metadata attribute 0', value: 'value' },
|
|
130
|
+
{ id: 'ma1', label: 'metadata attribute 1', value: 'value' },
|
|
131
|
+
],
|
|
132
|
+
'0::0': [
|
|
133
|
+
{ id: 'ma2', label: 'metadata attribute 2', value: 'value' },
|
|
134
|
+
{ id: 'ma3', label: 'metadata attribute 3', value: 'value' },
|
|
135
|
+
]
|
|
136
|
+
};
|
|
137
|
+
const options = {
|
|
138
|
+
display: 'code',
|
|
139
|
+
attributesLabel: 'Advanced Attributes'
|
|
140
|
+
};
|
|
141
|
+
const dataflow = {
|
|
142
|
+
id: 'DF',
|
|
143
|
+
name: 'Dataflow'
|
|
144
|
+
};
|
|
145
|
+
const dimensions = [
|
|
146
|
+
{ id: 'd0', name: 'dimension 0', values: [{ id: 'd0v0', name: 'value 0' }] },
|
|
147
|
+
{ id: 'd1', name: 'dimension 1', values: [{ id: 'd1v0', name: 'value 0' }] },
|
|
148
|
+
];
|
|
149
|
+
expect(getSidebarData(attributes, metadata, dataflow, dimensions, options)).to.deep.equal([
|
|
150
|
+
{
|
|
151
|
+
id: '0::',
|
|
152
|
+
label: 'd0: d0v0',
|
|
153
|
+
splitCoord: ['0', '', ''],
|
|
154
|
+
children: [
|
|
155
|
+
{
|
|
156
|
+
id: '0::-attr',
|
|
157
|
+
label: 'Advanced Attributes',
|
|
158
|
+
children: [
|
|
159
|
+
{
|
|
160
|
+
id: 'aa2',
|
|
161
|
+
label: 'advanced attribute 2',
|
|
162
|
+
value: 'value'
|
|
163
|
+
},
|
|
164
|
+
{
|
|
165
|
+
id: 'aa3',
|
|
166
|
+
label: 'advanced attribute 3',
|
|
167
|
+
value: 'value'
|
|
168
|
+
}
|
|
169
|
+
]
|
|
170
|
+
},
|
|
171
|
+
{
|
|
172
|
+
id: 'ma0',
|
|
173
|
+
label: 'metadata attribute 0',
|
|
174
|
+
value: 'value'
|
|
175
|
+
},
|
|
176
|
+
{
|
|
177
|
+
id: 'ma1',
|
|
178
|
+
label: 'metadata attribute 1',
|
|
179
|
+
value: 'value'
|
|
180
|
+
},
|
|
181
|
+
{
|
|
182
|
+
id: 'ma2',
|
|
183
|
+
label: 'metadata attribute 2',
|
|
184
|
+
value: 'value'
|
|
185
|
+
},
|
|
186
|
+
{
|
|
187
|
+
id: 'ma3',
|
|
188
|
+
label: 'metadata attribute 3',
|
|
189
|
+
value: 'value'
|
|
190
|
+
}
|
|
191
|
+
]
|
|
192
|
+
},
|
|
193
|
+
{
|
|
194
|
+
id: '::',
|
|
195
|
+
label: 'DF',
|
|
196
|
+
splitCoord: ['', '', ''],
|
|
197
|
+
children: [
|
|
198
|
+
{
|
|
199
|
+
id: '::-attr',
|
|
200
|
+
label: 'Advanced Attributes',
|
|
201
|
+
children: [
|
|
202
|
+
{
|
|
203
|
+
id: 'aa0',
|
|
204
|
+
label: 'advanced attribute 0',
|
|
205
|
+
value: 'value'
|
|
206
|
+
},
|
|
207
|
+
{
|
|
208
|
+
id: 'aa1',
|
|
209
|
+
label: 'advanced attribute 1',
|
|
210
|
+
value: 'value'
|
|
211
|
+
}
|
|
212
|
+
]
|
|
213
|
+
}
|
|
214
|
+
]
|
|
215
|
+
}
|
|
216
|
+
]);
|
|
217
|
+
});
|
|
116
218
|
it('non displayed dimensions handling', () => {
|
|
117
219
|
const attributes = {
|
|
118
220
|
'::': [
|