Skip to content

Commit

Permalink
Merge pull request #435 from BaseAdresseNationale/antoineludeau/fix-s…
Browse files Browse the repository at this point in the history
…tats-key-name

Modified key names for stats
  • Loading branch information
antoineludeau authored Jun 18, 2024
2 parents d54f6a2 + 162d276 commit e212698
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions lib/models/ban.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,13 @@ const defaultStatsOfDistrictsDataResult = {
nbAdressesCertifiees: 0,
nbCommunesCouvertes: 0,
populationCouverte: 0,
nbCommunesAvecBanId: 0,
nbAdressesAvecBanId: 0,
nbCommunesIdSocle: 0,
nbAdressesIdSocle: 0,
}

const defaultStatsOfAddressesDataResult = {
nbNumeroWithBanId: 0,
countDistinctCodeCommune: 0,
nbAdressesAvecBanId: 0,
nbCommunesAvecBanId: 0,
}

async function getStatsOfDistricts(cog = []) {
Expand Down Expand Up @@ -70,15 +70,15 @@ async function getStatsOfAddresses(cog) {
{
$group: {
_id: null,
nbNumeroWithBanId: {$sum: 1},
distinctCodeCommune: {$addToSet: '$codeCommune'}
nbAdressesAvecBanId: {$sum: 1},
nbCommunesAvecBanId: {$addToSet: '$codeCommune'}
}
},
{
$project: {
_id: 0,
nbNumeroWithBanId: '$nbNumeroWithBanId',
countDistinctCodeCommune: {$size: '$distinctCodeCommune'}
nbAdressesAvecBanId: '$nbAdressesAvecBanId',
nbCommunesAvecBanId: {$size: '$nbCommunesAvecBanId'}
}
},
]
Expand Down

0 comments on commit e212698

Please sign in to comment.