From fbde40263fe1f3120ff5a57ed1f1e489974d9592 Mon Sep 17 00:00:00 2001 From: bach Date: Tue, 19 Sep 2023 16:50:12 +0200 Subject: [PATCH] bugfix --- src/stores/concernements.js | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/src/stores/concernements.js b/src/stores/concernements.js index 3627e8e..6220677 100644 --- a/src/stores/concernements.js +++ b/src/stores/concernements.js @@ -63,6 +63,7 @@ export const ConcernementsStore = defineStore({ console.log('loadconcernements all loaded', allconcernements) this.concernements = []; // parse concernements + let temp_allSuperpositions = []; allconcernements.forEach(concernement => { concernement.visible = true; @@ -105,7 +106,7 @@ export const ConcernementsStore = defineStore({ // loop through all already recorded superposition to complete the array instead of create duplicates // TODO check if target cid and eid are accessible before recording the superposition // check if half of the superpositions is already recorded, if yes complete it (add the missing concernement id) - for(let superposition of this.allSuperpositions) { + for(let superposition of temp_allSuperpositions) { for(let superposition_item of superposition) { if (superposition_item.eid === entite.entite.id && !superposition_item.cid) { console.log(`already_recorded, eid:${entite.entite.id}, teid:${entite_superpose.id}`, entite.entite.title); @@ -132,7 +133,7 @@ export const ConcernementsStore = defineStore({ } ]; // concernement.superpositions.push(s); - this.allSuperpositions.push(s); + temp_allSuperpositions.push(s); } }) @@ -140,6 +141,7 @@ export const ConcernementsStore = defineStore({ } }); + // revisions concernement.active_revision = concernement.revision_id; @@ -171,7 +173,18 @@ export const ConcernementsStore = defineStore({ }); + console.log('temp_allSuperpositions', temp_allSuperpositions); + + // cleaning superpositions, removing all incomplète onces + temp_allSuperpositions.forEach(s => { + if (s[0] && s[0].cid && s[0].eid && s[1] && s[1].cid && s[1].eid) { + this.allSuperpositions.push(s); + } + }); + console.log('this.allSuperpositions', this.allSuperpositions); + + // Handle multiple superpositions accross two concernements for(let superposition of this.allSuperpositions){