@qrvey/utils 1.3.0-15 → 1.3.0-16
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.
|
@@ -14,7 +14,7 @@ function getFiltersByDatasetsColumns(data, datasets = []) {
|
|
|
14
14
|
return;
|
|
15
15
|
if ((0, isEmpty_1.isEmpty)(datasets))
|
|
16
16
|
return data;
|
|
17
|
-
|
|
17
|
+
const newData = Object.assign(Object.assign({}, data), { scopes: data.scopes.map(scope => (Object.assign(Object.assign({}, scope), { datasets: scope.datasets.map(filterDataset => {
|
|
18
18
|
const dataset = datasets.find(data => data.qrveyid === filterDataset.qrveyid);
|
|
19
19
|
if (!(0, isEmpty_1.isEmpty)(dataset)) {
|
|
20
20
|
return Object.assign(Object.assign({}, filterDataset), { filters: filterDataset.filters.map(filter => {
|
|
@@ -25,5 +25,8 @@ function getFiltersByDatasetsColumns(data, datasets = []) {
|
|
|
25
25
|
}).filter(Boolean) });
|
|
26
26
|
}
|
|
27
27
|
}).filter(dataset => !(0, isEmpty_1.isEmpty)(dataset) && dataset.filters.length > 0) }))).filter(scope => !(0, isEmpty_1.isEmpty)(scope) && scope.datasets.length > 0) });
|
|
28
|
+
if (!(0, isEmpty_1.isEmpty)(newData) && newData.scopes.length > 0) {
|
|
29
|
+
return newData;
|
|
30
|
+
}
|
|
28
31
|
}
|
|
29
32
|
exports.getFiltersByDatasetsColumns = getFiltersByDatasetsColumns;
|
|
@@ -11,7 +11,7 @@ export function getFiltersByDatasetsColumns(data, datasets = []) {
|
|
|
11
11
|
return;
|
|
12
12
|
if (isEmpty(datasets))
|
|
13
13
|
return data;
|
|
14
|
-
|
|
14
|
+
const newData = Object.assign(Object.assign({}, data), { scopes: data.scopes.map(scope => (Object.assign(Object.assign({}, scope), { datasets: scope.datasets.map(filterDataset => {
|
|
15
15
|
const dataset = datasets.find(data => data.qrveyid === filterDataset.qrveyid);
|
|
16
16
|
if (!isEmpty(dataset)) {
|
|
17
17
|
return Object.assign(Object.assign({}, filterDataset), { filters: filterDataset.filters.map(filter => {
|
|
@@ -22,4 +22,7 @@ export function getFiltersByDatasetsColumns(data, datasets = []) {
|
|
|
22
22
|
}).filter(Boolean) });
|
|
23
23
|
}
|
|
24
24
|
}).filter(dataset => !isEmpty(dataset) && dataset.filters.length > 0) }))).filter(scope => !isEmpty(scope) && scope.datasets.length > 0) });
|
|
25
|
+
if (!isEmpty(newData) && newData.scopes.length > 0) {
|
|
26
|
+
return newData;
|
|
27
|
+
}
|
|
25
28
|
}
|
package/package.json
CHANGED
|
@@ -13,7 +13,7 @@ export function getFiltersByDatasetsColumns(data: IFUData, datasets: IDataset[]
|
|
|
13
13
|
if (isEmpty(data) || isEmpty(data.scopes)) return;
|
|
14
14
|
if (isEmpty(datasets)) return data;
|
|
15
15
|
|
|
16
|
-
|
|
16
|
+
const newData = {
|
|
17
17
|
...data,
|
|
18
18
|
scopes: data.scopes.map(scope => ({
|
|
19
19
|
...scope,
|
|
@@ -33,4 +33,8 @@ export function getFiltersByDatasetsColumns(data: IFUData, datasets: IDataset[]
|
|
|
33
33
|
}).filter(dataset => !isEmpty(dataset) && dataset.filters.length > 0)
|
|
34
34
|
})).filter(scope => !isEmpty(scope) && scope.datasets.length > 0)
|
|
35
35
|
};
|
|
36
|
+
|
|
37
|
+
if (!isEmpty(newData) && newData.scopes.length > 0) {
|
|
38
|
+
return newData;
|
|
39
|
+
}
|
|
36
40
|
}
|