diff --git a/lib/models/ban.cjs b/lib/models/ban.cjs index 718ccc75..cf656a0d 100644 --- a/lib/models/ban.cjs +++ b/lib/models/ban.cjs @@ -29,10 +29,10 @@ async function getStatsOfDistricts(cog = []) { nbAdressesCertifiees: {$sum: '$nbNumerosCertifies'}, nbCommunesCouvertes: {$sum: 1}, populationCouverte: {$sum: '$population'}, - nbCommunesAvecBanId: {$sum: { + nbCommunesIdSocle: {$sum: { $cond: [{$eq: ['$withBanId', true]}, 1, 0] }}, - nbAdressesAvecBanId: {$sum: { + nbAdressesIdSocle: {$sum: { $cond: [{$eq: ['$withBanId', true]}, '$nbNumeros', 0] }} }