concernement with less than 3 entites are visible only if can_update
This commit is contained in:
		
							
								
								
									
										78
									
								
								src/App.vue
									
									
									
									
									
								
							
							
						
						
									
										78
									
								
								src/App.vue
									
									
									
									
									
								
							@@ -75,47 +75,51 @@ export default {
 | 
			
		||||
      // console.log('App couple_ids', couple_ids);
 | 
			
		||||
      // loop through all concernement
 | 
			
		||||
      for(let [concernement_id, concernement] of Object.entries(this.concernementsByID)){
 | 
			
		||||
        // create the main mapitem object
 | 
			
		||||
        let mapitem = {
 | 
			
		||||
          id: concernement.id,
 | 
			
		||||
          cid: concernement.id,
 | 
			
		||||
          visible: concernement.visible,
 | 
			
		||||
          // concernement: concernement,
 | 
			
		||||
          // superposition_ids: [],
 | 
			
		||||
          superposition_cluster_index: -1,
 | 
			
		||||
          clone: false,
 | 
			
		||||
          concernements_loading_nb: this.concernements_loading_nb
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        // loop through all superposition_clusters
 | 
			
		||||
        for( let [cluster_index, cluster] of this.allSuperpositions_clustered.entries()){
 | 
			
		||||
          let cids = [];
 | 
			
		||||
          // console.log(`cluster ${cluster_index}`, cluster);
 | 
			
		||||
          for( let s of cluster){
 | 
			
		||||
            cids.push(s.cid)
 | 
			
		||||
        // TODO check if more than 3 entities or if connected user if author
 | 
			
		||||
        if (concernement.entites.length > 3 || concernement.can_update) {
 | 
			
		||||
          // create the main mapitem object
 | 
			
		||||
          let mapitem = {
 | 
			
		||||
            id: concernement.id,
 | 
			
		||||
            cid: concernement.id,
 | 
			
		||||
            visible: concernement.visible,
 | 
			
		||||
            // concernement: concernement,
 | 
			
		||||
            // superposition_ids: [],
 | 
			
		||||
            superposition_cluster_index: -1,
 | 
			
		||||
            clone: false,
 | 
			
		||||
            concernements_loading_nb: this.concernements_loading_nb
 | 
			
		||||
          }
 | 
			
		||||
          // console.log(`cids:${cids}`);
 | 
			
		||||
          if(cids.indexOf(concernement.id) !== -1){
 | 
			
		||||
            // console.log('concernement in cluster');
 | 
			
		||||
            if (mapitem.superposition_cluster_index === -1) {
 | 
			
		||||
              // if main map item does not yet have a superposition use it and alter his id (for matter constraints)
 | 
			
		||||
              mapitem.superposition_cluster_index = cluster_index
 | 
			
		||||
              mapitem.id = `${concernement.id}___${cluster_index}`
 | 
			
		||||
            }else{
 | 
			
		||||
              let mapitem_superposition = {
 | 
			
		||||
                id: `${concernement.id}___${cluster_index}`,
 | 
			
		||||
                cid: concernement.id,
 | 
			
		||||
                // concernement: concernement,
 | 
			
		||||
                superposition_cluster_index: cluster_index,
 | 
			
		||||
                clone: true
 | 
			
		||||
              };
 | 
			
		||||
              this.mapitems.push(mapitem_superposition);
 | 
			
		||||
              this.allMapItems_byid[mapitem_superposition.id] = mapitem_superposition;
 | 
			
		||||
  
 | 
			
		||||
          // loop through all superposition_clusters
 | 
			
		||||
          for( let [cluster_index, cluster] of this.allSuperpositions_clustered.entries()){
 | 
			
		||||
            let cids = [];
 | 
			
		||||
            // console.log(`cluster ${cluster_index}`, cluster);
 | 
			
		||||
            for( let s of cluster){
 | 
			
		||||
              cids.push(s.cid)
 | 
			
		||||
            }
 | 
			
		||||
            // console.log(`cids:${cids}`);
 | 
			
		||||
            if(cids.indexOf(concernement.id) !== -1){
 | 
			
		||||
              // console.log('concernement in cluster');
 | 
			
		||||
              if (mapitem.superposition_cluster_index === -1) {
 | 
			
		||||
                // if main map item does not yet have a superposition use it and alter his id (for matter constraints)
 | 
			
		||||
                mapitem.superposition_cluster_index = cluster_index
 | 
			
		||||
                mapitem.id = `${concernement.id}___${cluster_index}`
 | 
			
		||||
              }else{
 | 
			
		||||
                let mapitem_superposition = {
 | 
			
		||||
                  id: `${concernement.id}___${cluster_index}`,
 | 
			
		||||
                  cid: concernement.id,
 | 
			
		||||
                  // concernement: concernement,
 | 
			
		||||
                  superposition_cluster_index: cluster_index,
 | 
			
		||||
                  clone: true
 | 
			
		||||
                };
 | 
			
		||||
                this.mapitems.push(mapitem_superposition);
 | 
			
		||||
                this.allMapItems_byid[mapitem_superposition.id] = mapitem_superposition;
 | 
			
		||||
              }
 | 
			
		||||
            }
 | 
			
		||||
          }
 | 
			
		||||
          this.mapitems.push(mapitem)
 | 
			
		||||
          this.allMapItems_byid[mapitem.id] = mapitem;
 | 
			
		||||
          
 | 
			
		||||
        }
 | 
			
		||||
        this.mapitems.push(mapitem)
 | 
			
		||||
        this.allMapItems_byid[mapitem.id] = mapitem;
 | 
			
		||||
      }
 | 
			
		||||
      console.log('App mapitems', this.mapitems);
 | 
			
		||||
    }
 | 
			
		||||
 
 | 
			
		||||
@@ -95,8 +95,7 @@ export const ConcernementsStore = defineStore({
 | 
			
		||||
        concernement.has_proximites = false;
 | 
			
		||||
        concernement.has_superpositions = false;
 | 
			
		||||
        concernement.has_agissantes = false;
 | 
			
		||||
        // var entites_temp = concernement.entites; // record a temp entites liste
 | 
			
		||||
        // concernement.entites = []; // erase the concernement.entite array as we want to keep only visible entites
 | 
			
		||||
        
 | 
			
		||||
        concernement.entites.forEach(entite => {
 | 
			
		||||
          // console.log(`parsing entite ${entite.id}`);
 | 
			
		||||
          if (entite.entite) { // entite.entite may be null because of workflow confidentiality
 | 
			
		||||
@@ -115,8 +114,7 @@ export const ConcernementsStore = defineStore({
 | 
			
		||||
              this.allEntitesById[entite.entite.id] = entite;
 | 
			
		||||
              this.allEntitesById[entite.entite.id].cid = concernement.id;
 | 
			
		||||
            }
 | 
			
		||||
            // concernement.entites.push(entite); // fill the entites array with visible entite only
 | 
			
		||||
 | 
			
		||||
        
 | 
			
		||||
            // PROXIMITES
 | 
			
		||||
            if (entite.entite.proximite.length) {
 | 
			
		||||
              // console.log("proximite", entite.entite.proximite);
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user