Skip to content

Commit

Permalink
Merge pull request #64 from anct-cnum/Fix_requete_details_cra
Browse files Browse the repository at this point in the history
Fix de la requete avec codeDepartement et ajout de la date d'update
  • Loading branch information
MorganP-projects authored Aug 4, 2023
2 parents e99f311 + 903c26d commit 953d2c6
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
2 changes: 2 additions & 0 deletions src/tasks/stats/cras/crasByDepartements/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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();
}));
Expand Down
Original file line number Diff line number Diff line change
@@ -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 }
);
Expand Down

0 comments on commit 953d2c6

Please sign in to comment.