Skip to content

Commit

Permalink
fix: Réactivation de l'historique
Browse files Browse the repository at this point in the history
  • Loading branch information
QuentinPetel committed Feb 18, 2023
1 parent 41d9e30 commit a80f19f
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 11 deletions.
8 changes: 4 additions & 4 deletions server/src/common/model/createModel.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// const diffHistory = require("mongoose-diff-history/diffHistory");
const diffHistory = require("mongoose-diff-history/diffHistory");
const { mongoose } = require("../mongodb");
const { mongoosastic, getElasticInstance } = require("../esClient");

Expand All @@ -17,9 +17,9 @@ const createModel = (modelName, [schemaDescriptor, schemaOptions], options = {})
options.createMongoDBIndexes(schema);
}

// if (options.diff) {
// schema.plugin(diffHistory.plugin, options.diff);
// }
if (options.diff) {
schema.plugin(diffHistory.plugin, options.diff);
}

return mongoose.model(modelName, schema, options.collectionName);
};
Expand Down
5 changes: 2 additions & 3 deletions server/src/jobs/etablissements/importer/converter.js
Original file line number Diff line number Diff line change
Expand Up @@ -80,12 +80,11 @@ const applyConversion = async () => {
DualControlEtablissement.find().sort(),

async ({ siret }) => {
// console.debug(siret);
const dcEtablissement = await DualControlEtablissement.findOne({ siret }).lean();
const etablissement = await Etablissement.findOne({ siret }).lean();

// console.log("================================");
// console.log({ etablissement, dcEtablissement });
// console.log({ siret, etablissement, dcEtablissement });
// console.log("================================");

// Si l'établissement existe
Expand Down Expand Up @@ -138,7 +137,7 @@ const converter = async () => {
error = e;
logger.error(
{
type: "http",
type: "job",
},
e
);
Expand Down
2 changes: 1 addition & 1 deletion server/src/jobs/etablissements/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ const etablissementsJobs = async () => {
} catch (error) {
logger.error(
{
type: "http",
type: "job",
},
error
);
Expand Down
5 changes: 2 additions & 3 deletions server/src/jobs/formations/importer/converter.js
Original file line number Diff line number Diff line change
Expand Up @@ -306,12 +306,11 @@ const applyConversion = async ({ forceRecompute = false, skip = 0 } = { forceRec
DualControlFormation.find({}).sort().skip(skip),

async ({ cle_ministere_educatif }) => {
// console.log(cle_ministere_educatif);
const dcFormation = await DualControlFormation.findOne({ cle_ministere_educatif }).lean();
const formation = await Formation.findOne({ cle_ministere_educatif }).lean();

// console.log("================================");
// console.log({ formation, dcFormation });
// console.log({ cle_ministere_educatif, formation, dcFormation });
// console.log("================================");

// Si la formation existe
Expand Down Expand Up @@ -353,7 +352,7 @@ const applyConversion = async ({ forceRecompute = false, skip = 0 } = { forceRec

// Si la formation n'existe pas
else {
// console.warn(`${dcFormation.cle_ministere_educatif} not found`);
// console.info(`${dcFormation.cle_ministere_educatif} not found`);
added++;

await Formation.create(await recomputeFields(dcFormation, null, { forceRecompute }));
Expand Down

0 comments on commit a80f19f

Please sign in to comment.