Skip to content

Commit

Permalink
sort by year and limit range
Browse files Browse the repository at this point in the history
  • Loading branch information
jerem1508 committed Aug 5, 2024
1 parent 8795a8e commit da83b29
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions server/src/routes/tableaux/european-projects/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -701,10 +701,16 @@ router
if (req.query.country_code) {
req.query.country_code = req.query.country_code.toUpperCase();
}
const rangeOfYears = ["2021", "2022", "2023"];
const data_country = await db
.collection("fr-esr-all-projects-synthese")
.aggregate([
{ $match: { country_code: req.query.country_code } },
{
$match: {
country_code: req.query.country_code,
call_year: { $in: rangeOfYears },
},
},
{
$group: {
_id: {
Expand Down Expand Up @@ -755,7 +761,7 @@ router
total_evaluated: 1,
},
},
{ $sort: { pilier_name_fr: 1 } },
{ $sort: { pilier_name_fr: 1, year: 1 } },
])
.toArray();

Expand Down

0 comments on commit da83b29

Please sign in to comment.