superpositions: displaying the right entite to the right map_item
This commit is contained in:
41
src/App.vue
41
src/App.vue
@@ -32,27 +32,28 @@ export default {
|
||||
let clones = [];
|
||||
// loop through all superposition grouped by concernements couples
|
||||
for(let [couple_id, superpositions] of Object.entries(this.allSuperpositions_byid)){
|
||||
// if one concernement couple has more than one superposition
|
||||
let superpositions_ids = Object.keys(superpositions);
|
||||
if (superpositions_ids.length > 1) {
|
||||
// loop through these superpositions for one concernement couple starting with the second
|
||||
let i = 0;
|
||||
for(let [superposition_id, superposition] of Object.entries(superpositions)){
|
||||
i++
|
||||
if (i === 1) {
|
||||
continue;
|
||||
}
|
||||
// first concernement of the couple
|
||||
clones.push({
|
||||
concernement: this.concernementsByID[superposition[0].cid],
|
||||
superposition_id: superposition_id
|
||||
})
|
||||
// second concernement of the couple
|
||||
clones.push({
|
||||
concernement: this.concernementsByID[superposition[1].cid],
|
||||
superposition_id: superposition_id
|
||||
})
|
||||
// loop through all superpositions for one concernement couple and mark the first as NOT cloned and clone the others and mark them as cloned
|
||||
let i = 0;
|
||||
for(let [superposition_id, superposition] of Object.entries(superpositions)){
|
||||
i++
|
||||
if (i === 1) {
|
||||
// first superposition of the couple is not cloned
|
||||
this.allSuperpositions_byid[couple_id][superposition_id].cloned = false;
|
||||
continue;
|
||||
}
|
||||
// following superpositions of the couple generate concernement map_item clones
|
||||
// first concernement of the couple
|
||||
clones.push({
|
||||
concernement: this.concernementsByID[superposition[0].cid],
|
||||
superposition_id: superposition_id
|
||||
})
|
||||
// second concernement of the couple
|
||||
clones.push({
|
||||
concernement: this.concernementsByID[superposition[1].cid],
|
||||
superposition_id: superposition_id
|
||||
})
|
||||
|
||||
this.allSuperpositions_byid[couple_id][superposition_id].cloned = true;
|
||||
}
|
||||
}
|
||||
return clones;
|
||||
|
||||
Reference in New Issue
Block a user