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)
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);
}
})
@ -141,6 +142,7 @@ export const ConcernementsStore = defineStore({
}
});
// revisions
concernement.active_revision = concernement.revision_id;
concernement.revisions_byid = {};
@ -171,8 +173,19 @@ 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){
let superposition_couple_id = `${superposition[0].cid}-${superposition[1].cid}`;