This commit is contained in:
Bachir Soussi Chiadmi 2023-09-19 16:50:12 +02:00
parent fea17b2d6b
commit fbde40263f

View File

@ -63,6 +63,7 @@ export const ConcernementsStore = defineStore({
console.log('loadconcernements all loaded', allconcernements) console.log('loadconcernements all loaded', allconcernements)
this.concernements = []; this.concernements = [];
// parse concernements // parse concernements
let temp_allSuperpositions = [];
allconcernements.forEach(concernement => { allconcernements.forEach(concernement => {
concernement.visible = true; 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 // 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 // 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) // 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) { for(let superposition_item of superposition) {
if (superposition_item.eid === entite.entite.id && !superposition_item.cid) { 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); 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); // concernement.superpositions.push(s);
this.allSuperpositions.push(s); temp_allSuperpositions.push(s);
} }
}) })
@ -140,6 +141,7 @@ export const ConcernementsStore = defineStore({
} }
}); });
// revisions // revisions
concernement.active_revision = concernement.revision_id; 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); console.log('this.allSuperpositions', this.allSuperpositions);
// Handle multiple superpositions accross two concernements // Handle multiple superpositions accross two concernements
for(let superposition of this.allSuperpositions){ for(let superposition of this.allSuperpositions){