Skip to content

Commit

Permalink
update sets
Browse files Browse the repository at this point in the history
  • Loading branch information
Bamieh committed Mar 23, 2021
1 parent c4ecfa2 commit c37d35f
Showing 1 changed file with 14 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -53,20 +53,25 @@ export default new Datasource('worldbank_indicators', {
});

const countries = config.country.split(':');
const seriesLists = _.map(countries, function (country) {
const seriesListSets = _.map(countries, function (country) {
const code = 'country/' + country + '/indicator/' + config.indicator;
const wbArgs = [code];
wbArgs.byName = { code: code };
return worldbank.timelionFn(wbArgs, tlConfig);
});

return Promise.all(seriesLists, function (seriesList) {
return seriesList.list[0];
}).then(function (list) {
return {
type: 'seriesList',
list: list,
};
});
return Promise.all(seriesListSets)
.then((seriesLists) => {
return seriesLists.reduce((acc, seriesList) => {
acc.push(seriesList.list[0]);
return acc;
}, []);
})
.then(function (list) {
return {
type: 'seriesList',
list: list,
};
});
},
});

0 comments on commit c37d35f

Please sign in to comment.