diff --git a/src/tasks/stats/cras/crasByDepartements/index.js b/src/tasks/stats/cras/crasByDepartements/index.js index dd18340..0876ba6 100644 --- a/src/tasks/stats/cras/crasByDepartements/index.js +++ b/src/tasks/stats/cras/crasByDepartements/index.js @@ -31,6 +31,7 @@ const findAndInsertStats = async (dbDatalake, query, departement) => { 'repartition_statuts': statutsParDepartement, 'repartition_thematiques': themesParDepartement.themes, 'repartition_sous_thematiques': themesParDepartement.sousThemes, + 'updatedAt': new Date(), }; await statsAlltasks.insertStatsOutilPrefet(dbDatalake)(statsOutilPrefet); @@ -58,6 +59,7 @@ execute(__filename, async ({ logger, dbDatalake }) => { //Lorsque les codeCommune seront importer => 'cra.codeCommune': { $regex: new RegExp(regex) }, 'cra.codePostal': { $regex: new RegExp(regex) } }; + await findAndInsertStats(dbDatalake, query, departement); resolve(); })); diff --git a/src/tasks/stats/cras/crasByDepartements/tasks/insertStatsOutilPrefet.js b/src/tasks/stats/cras/crasByDepartements/tasks/insertStatsOutilPrefet.js index e9032c7..e2cdee2 100644 --- a/src/tasks/stats/cras/crasByDepartements/tasks/insertStatsOutilPrefet.js +++ b/src/tasks/stats/cras/crasByDepartements/tasks/insertStatsOutilPrefet.js @@ -1,6 +1,6 @@ const insertStatsOutilPrefet = dbDatalake => async statsOutilPrefet => await dbDatalake.collection('stats_departements_cras_details').replaceOne( - { num_dep: statsOutilPrefet.num_dep }, + { codeDepartement: statsOutilPrefet.num_dep }, statsOutilPrefet, { upsert: true } );