Skip to content

Commit e0cb8e4

Browse files
authored
Merge pull request #340 from vbakke/fix/mapping-undefined
Fix failing mapping load
2 parents b2b6132 + dfebf16 commit e0cb8e4

File tree

3 files changed

+84
-64
lines changed

3 files changed

+84
-64
lines changed

src/app/component/circular-heatmap/circular-heatmap.component.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -398,7 +398,7 @@ export class CircularHeatmapComponent implements OnInit {
398398
.append('svg')
399399
.attr('width', '60%') // 70% forces the heatmap down
400400
.attr('height', 'auto')
401-
.attr('viewBox', '0 0 1150 1150')
401+
.attr('viewBox', '0 0 1150 1150')
402402
.append('g')
403403
.attr(
404404
'transform',

src/app/component/mapping/mapping.component.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -271,7 +271,7 @@
271271
</ng-container>
272272
</td>
273273
<td *ngFor="let key of allTeams">
274-
<ng-container>
274+
<ng-container *ngIf="item.teamImplementation">
275275
{{ item.teamImplementation[key] }}
276276
</ng-container>
277277
</td>

src/app/component/mapping/mapping.component.ts

Lines changed: 82 additions & 62 deletions
Original file line numberDiff line numberDiff line change
@@ -154,12 +154,18 @@ export class MappingComponent implements OnInit {
154154
]
155155
);
156156
for (let a = 0; a < activityInCurrentSubDimension.length; a++) {
157-
if (a == 0) {
158-
this.allTeams = Object.keys(
157+
if (!this.allTeams || this.allTeams.length == 0) {
158+
if (
159159
this.YamlObject[this.allDimensionNames[i]][
160160
subdimensionsInCurrentDimension[j]
161161
][activityInCurrentSubDimension[a]]['teamsImplemented']
162-
);
162+
) {
163+
this.allTeams = Object.keys(
164+
this.YamlObject[this.allDimensionNames[i]][
165+
subdimensionsInCurrentDimension[j]
166+
][activityInCurrentSubDimension[a]]['teamsImplemented']
167+
);
168+
}
163169
}
164170
this.setValueandAppendToDatasetSortedbyActivity(
165171
this.allDimensionNames[i],
@@ -247,26 +253,31 @@ export class MappingComponent implements OnInit {
247253
ISO22: ISO22Array,
248254
samm2: '',
249255
};
250-
if (SAMMArray.length == 0) {
251-
this.allMappingDataSortedBySAMM.push(this.temporaryMappingElement);
252-
if (this.YamlObject[dim][subDim][activity]['isImplemented']) {
253-
this.performedMappingDataSortedBySAMM.push(
254-
this.temporaryMappingElement
255-
);
256-
} else {
257-
this.plannedMappingDataSortedBySAMM.push(this.temporaryMappingElement);
256+
257+
if (SAMMArray) {
258+
if (SAMMArray.length == 0) {
259+
this.allMappingDataSortedBySAMM.push(this.temporaryMappingElement);
260+
if (this.YamlObject[dim][subDim][activity]['isImplemented']) {
261+
this.performedMappingDataSortedBySAMM.push(
262+
this.temporaryMappingElement
263+
);
264+
} else {
265+
this.plannedMappingDataSortedBySAMM.push(
266+
this.temporaryMappingElement
267+
);
268+
}
258269
}
259-
}
260-
for (var i = 0; i < SAMMArray.length; i++) {
261-
const newTempElement = JSON.parse(
262-
JSON.stringify(this.temporaryMappingElement)
263-
);
264-
newTempElement['samm2'] = SAMMArray[i];
265-
this.allMappingDataSortedBySAMM.push(newTempElement);
266-
if (this.YamlObject[dim][subDim][activity]['isImplemented']) {
267-
this.performedMappingDataSortedBySAMM.push(newTempElement);
268-
} else {
269-
this.plannedMappingDataSortedBySAMM.push(newTempElement);
270+
for (var i = 0; i < SAMMArray.length; i++) {
271+
const newTempElement = JSON.parse(
272+
JSON.stringify(this.temporaryMappingElement)
273+
);
274+
newTempElement['samm2'] = SAMMArray[i];
275+
this.allMappingDataSortedBySAMM.push(newTempElement);
276+
if (this.YamlObject[dim][subDim][activity]['isImplemented']) {
277+
this.performedMappingDataSortedBySAMM.push(newTempElement);
278+
} else {
279+
this.plannedMappingDataSortedBySAMM.push(newTempElement);
280+
}
270281
}
271282
}
272283
//sorting by descending order
@@ -372,27 +383,31 @@ export class MappingComponent implements OnInit {
372383
};
373384

374385
console.log(this.temporaryMappingElement);
375-
if (ISOArray.length == 0) {
376-
this.allMappingDataSortedByISO17.push(this.temporaryMappingElement);
377-
if (this.YamlObject[dim][subDim][activity]['isImplemented']) {
378-
this.performedMappingDataSortedByISO17.push(
379-
this.temporaryMappingElement
380-
);
381-
} else {
382-
this.plannedMappingDataSortedByISO17.push(this.temporaryMappingElement);
386+
if (ISOArray) {
387+
if (ISOArray.length == 0) {
388+
this.allMappingDataSortedByISO17.push(this.temporaryMappingElement);
389+
if (this.YamlObject[dim][subDim][activity]['isImplemented']) {
390+
this.performedMappingDataSortedByISO17.push(
391+
this.temporaryMappingElement
392+
);
393+
} else {
394+
this.plannedMappingDataSortedByISO17.push(
395+
this.temporaryMappingElement
396+
);
397+
}
383398
}
384-
}
385-
for (var i = 0; i < ISOArray.length; i++) {
386-
const newTempElement = JSON.parse(
387-
JSON.stringify(this.temporaryMappingElement)
388-
);
389-
newTempElement['ISO17'] = ISOArray[i];
390-
//console.log(newTempElement);
391-
this.allMappingDataSortedByISO17.push(newTempElement);
392-
if (this.YamlObject[dim][subDim][activity]['isImplemented']) {
393-
this.performedMappingDataSortedByISO17.push(newTempElement);
394-
} else {
395-
this.plannedMappingDataSortedByISO17.push(newTempElement);
399+
for (var i = 0; i < ISOArray.length; i++) {
400+
const newTempElement = JSON.parse(
401+
JSON.stringify(this.temporaryMappingElement)
402+
);
403+
newTempElement['ISO17'] = ISOArray[i];
404+
//console.log(newTempElement);
405+
this.allMappingDataSortedByISO17.push(newTempElement);
406+
if (this.YamlObject[dim][subDim][activity]['isImplemented']) {
407+
this.performedMappingDataSortedByISO17.push(newTempElement);
408+
} else {
409+
this.plannedMappingDataSortedByISO17.push(newTempElement);
410+
}
396411
}
397412
}
398413
//sorting by descending order
@@ -429,27 +444,32 @@ export class MappingComponent implements OnInit {
429444
ISO22: '',
430445
samm2: SAMMArray,
431446
};
432-
if (ISO22Array.length == 0) {
433-
this.allMappingDataSortedByISO22.push(this.temporaryMappingElement);
434-
if (this.YamlObject[dim][subDim][activity]['isImplemented']) {
435-
this.performedMappingDataSortedByISO22.push(
436-
this.temporaryMappingElement
437-
);
438-
} else {
439-
this.plannedMappingDataSortedByISO22.push(this.temporaryMappingElement);
447+
448+
if (ISO22Array) {
449+
if (ISO22Array.length == 0) {
450+
this.allMappingDataSortedByISO22.push(this.temporaryMappingElement);
451+
if (this.YamlObject[dim][subDim][activity]['isImplemented']) {
452+
this.performedMappingDataSortedByISO22.push(
453+
this.temporaryMappingElement
454+
);
455+
} else {
456+
this.plannedMappingDataSortedByISO22.push(
457+
this.temporaryMappingElement
458+
);
459+
}
440460
}
441-
}
442-
for (var i = 0; i < ISO22Array.length; i++) {
443-
const newTempElement = JSON.parse(
444-
JSON.stringify(this.temporaryMappingElement)
445-
);
446-
newTempElement['ISO22'] = ISO22Array[i];
447-
//console.log(newTempElement);
448-
this.allMappingDataSortedByISO22.push(newTempElement);
449-
if (this.YamlObject[dim][subDim][activity]['isImplemented']) {
450-
this.performedMappingDataSortedByISO22.push(newTempElement);
451-
} else {
452-
this.plannedMappingDataSortedByISO22.push(newTempElement);
461+
for (var i = 0; i < ISO22Array.length; i++) {
462+
const newTempElement = JSON.parse(
463+
JSON.stringify(this.temporaryMappingElement)
464+
);
465+
newTempElement['ISO22'] = ISO22Array[i];
466+
//console.log(newTempElement);
467+
this.allMappingDataSortedByISO22.push(newTempElement);
468+
if (this.YamlObject[dim][subDim][activity]['isImplemented']) {
469+
this.performedMappingDataSortedByISO22.push(newTempElement);
470+
} else {
471+
this.plannedMappingDataSortedByISO22.push(newTempElement);
472+
}
453473
}
454474
}
455475
//sorting by descending order

0 commit comments

Comments
 (0)