[develop | DONE | ADDED ] utils service: add calculation date for grouped requests (useful when the response is cached)
This commit is contained in:
parent
974c43b00d
commit
4ca47d7f36
|
@ -131,7 +131,8 @@ app.get('/explore/home', async function (req, res) {
|
||||||
funders: parseNoOfFunders(dataResponses[1].data, dataResponses[4].data),
|
funders: parseNoOfFunders(dataResponses[1].data, dataResponses[4].data),
|
||||||
datasetsInterlinked:dataResponses[5].data.meta.total,
|
datasetsInterlinked:dataResponses[5].data.meta.total,
|
||||||
softwareInterlinked:dataResponses[6].data.meta.total,
|
softwareInterlinked:dataResponses[6].data.meta.total,
|
||||||
success:allRequestsSuccessful
|
success:allRequestsSuccessful,
|
||||||
|
calculated_at: (new Date()).toUTCString()
|
||||||
|
|
||||||
};
|
};
|
||||||
// Send the aggregated data as the response
|
// Send the aggregated data as the response
|
||||||
|
@ -162,7 +163,8 @@ app.get('/explore/search', async function (req, res) {
|
||||||
datasources: dataResponses[1].data.total,
|
datasources: dataResponses[1].data.total,
|
||||||
organizations: dataResponses[2].data.meta.total,
|
organizations: dataResponses[2].data.meta.total,
|
||||||
projects:dataResponses[3].data.total,
|
projects:dataResponses[3].data.total,
|
||||||
success:allRequestsSuccessful
|
success:allRequestsSuccessful,
|
||||||
|
calculated_at: (new Date()).toUTCString()
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -204,7 +206,8 @@ app.get('/portals/countResults', async function (req, res) {
|
||||||
datasets: dataResponses[1].data.total,
|
datasets: dataResponses[1].data.total,
|
||||||
software: dataResponses[2].data.total,
|
software: dataResponses[2].data.total,
|
||||||
other:dataResponses[3].data.total,
|
other:dataResponses[3].data.total,
|
||||||
success:allRequestsSuccessful
|
success:allRequestsSuccessful,
|
||||||
|
calculated_at: (new Date()).toUTCString()
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -357,7 +360,8 @@ app.get('/explore/funders', async function (req, res) {
|
||||||
results: dataResponses[0].data.meta.total,
|
results: dataResponses[0].data.meta.total,
|
||||||
projects: dataResponses[2].data.meta.total,
|
projects: dataResponses[2].data.meta.total,
|
||||||
funders: Array.from(fundersMap.values()),
|
funders: Array.from(fundersMap.values()),
|
||||||
success:allRequestsSuccessful
|
success:allRequestsSuccessful,
|
||||||
|
calculated_at: (new Date()).toUTCString()
|
||||||
|
|
||||||
};
|
};
|
||||||
res.status(allRequestsSuccessful?200:207).json(aggregatedData);
|
res.status(allRequestsSuccessful?200:207).json(aggregatedData);
|
||||||
|
|
Loading…
Reference in New Issue