|
@@ -22,6 +22,7 @@ export const ConcernementsStore = defineStore({
|
|
|
allEntitesById: {},
|
|
|
allBesoinsById: {},
|
|
|
allSuperpositions: [],
|
|
|
+ allSuperpositions_byid: {},
|
|
|
allProximites: [],
|
|
|
opened_concernement: false,
|
|
|
opened_entite_id: null,
|
|
@@ -92,13 +93,16 @@ export const ConcernementsStore = defineStore({
|
|
|
// SUPERPOSITIONS
|
|
|
if (entite.entite.superposition.length) {
|
|
|
concernement.has_superpositions = true;
|
|
|
+ // concernement.superpositions = [];
|
|
|
concernement.superposition_constraints_id = [];
|
|
|
- concernement.superposed_concernements_id = [];
|
|
|
+ concernement.superposed_concernements_id = [];
|
|
|
+
|
|
|
entite.entite.superposition.forEach(entite_superpose => {
|
|
|
// console.log(`superposition eid:${entite.entite.id}, teid:${entite_superpose.id}`);
|
|
|
let already_recorded = false;
|
|
|
// 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_item of superposition) {
|
|
|
if (superposition_item.eid === entite.entite.id && !superposition_item.cid) {
|
|
@@ -112,10 +116,10 @@ export const ConcernementsStore = defineStore({
|
|
|
break;
|
|
|
}
|
|
|
}
|
|
|
- // if not already recorded, add it to the array
|
|
|
+ // if not already recorded, add it to the array. It is incomplete has it's missing one concernement id wich will be filled in next loops
|
|
|
if (!already_recorded) {
|
|
|
console.log(`NOT already_recorded, eid:${entite.entite.id}, teid:${entite_superpose.id}`, entite.entite.title);
|
|
|
- this.allSuperpositions.push([
|
|
|
+ let s = [
|
|
|
{
|
|
|
cid: concernement.id,
|
|
|
eid: entite.entite.id
|
|
@@ -124,7 +128,10 @@ export const ConcernementsStore = defineStore({
|
|
|
cid: null,
|
|
|
eid: entite_superpose.id
|
|
|
}
|
|
|
- ])
|
|
|
+ ];
|
|
|
+ // concernement.superpositions.push(s);
|
|
|
+ this.allSuperpositions.push(s);
|
|
|
+
|
|
|
}
|
|
|
})
|
|
|
}
|
|
@@ -161,7 +168,19 @@ export const ConcernementsStore = defineStore({
|
|
|
this.concernementsByID[concernement.id] = concernement;
|
|
|
|
|
|
});
|
|
|
+
|
|
|
console.log('this.allSuperpositions', this.allSuperpositions);
|
|
|
+
|
|
|
+ // Handle multiple superpositions accross two concernements
|
|
|
+ for(let superposition of this.allSuperpositions){
|
|
|
+ let superposition_id = `${superposition[0].cid}-${superposition[1].cid}`
|
|
|
+ if (!this.allSuperpositions_byid[superposition_id]) {
|
|
|
+ this.allSuperpositions_byid[superposition_id] = [];
|
|
|
+ }
|
|
|
+ this.allSuperpositions_byid[superposition_id].push(superposition);
|
|
|
+ }
|
|
|
+ console.log('this.allSuperpositions_byid', this.allSuperpositions_byid);
|
|
|
+
|
|
|
this.concernements_loaded = true;
|
|
|
})
|
|
|
.catch(error => {
|