bach пре 1 година
родитељ
комит
fbde40263f
1 измењених фајлова са 15 додато и 2 уклоњено
  1. 15 2
      src/stores/concernements.js

+ 15 - 2
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){