Skip to content

Commit 17cc17f

Browse files
committed
Updated %done logic: color based on only teams visible
1 parent e5cbb08 commit 17cc17f

1 file changed

Lines changed: 37 additions & 26 deletions

File tree

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

Lines changed: 37 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -232,18 +232,19 @@ export class CircularHeatmapComponent implements OnInit {
232232
teamKey
233233
];
234234
// Creating counter for %done
235-
for (var i = 0; i < this.ALL_CARD_DATA[index]['Task'].length; i++) {
236-
var teamList: any;
237-
teamList = this.ALL_CARD_DATA[index]['Task'][i]['teamsImplemented'];
238-
(Object.keys(teamList) as (keyof typeof teamList)[]).forEach(
239-
(key, index) => {
240-
if (teamList[key] === true) {
241-
cntTrue += 1;
242-
}
243-
cntAll += 1;
244-
}
245-
);
246-
}
235+
// for (var i = 0; i < this.ALL_CARD_DATA[index]['Task'].length; i++) {
236+
// var teamList: any;
237+
// teamList = this.ALL_CARD_DATA[index]['Task'][i]['teamsImplemented'];
238+
// // (Object.keys(teamList) as (keyof typeof teamList)[]).forEach(
239+
// // (key, index) => {
240+
// // if (teamList[key] === true) {
241+
// // cntTrue += 1;
242+
// // }
243+
// // cntAll += 1;
244+
// // }
245+
// // );
246+
247+
// }
247248

248249
this.ALL_CARD_DATA[index]['Done%'] = cntTrue / cntAll;
249250
console.log(this.ALL_CARD_DATA[index]['Done%'], cntTrue);
@@ -261,6 +262,7 @@ export class CircularHeatmapComponent implements OnInit {
261262
return color(_self.ALL_CARD_DATA[index]['Done%']);
262263
});
263264
this.saveState();
265+
this.reColorHeatmap();
264266
}
265267

266268
loadCircularHeatMap(
@@ -400,6 +402,7 @@ export class CircularHeatmapComponent implements OnInit {
400402
).attr('fill', '#DCDCDC');
401403
}
402404
});
405+
this.reColorHeatmap();
403406
}
404407

405408
circularHeatChart(num_of_segments: number) {
@@ -659,23 +662,31 @@ export class CircularHeatmapComponent implements OnInit {
659662
let cntTrue: number = 0;
660663
var _self = this;
661664
for (var i = 0; i < this.ALL_CARD_DATA[index]['Task'].length; i++) {
662-
var teamList: any;
663-
teamList = this.ALL_CARD_DATA[index]['Task'][i]['teamsImplemented'];
664-
(Object.keys(teamList) as (keyof typeof teamList)[]).forEach(
665+
var taskTeamList: any;
666+
taskTeamList = this.ALL_CARD_DATA[index]['Task'][i]['teamsImplemented'];
667+
(Object.keys(taskTeamList) as (keyof typeof taskTeamList)[]).forEach(
665668
(key, index) => {
666-
if (
667-
this.selectedTeamChips[0] === 'All' ||
668-
key === this.selectedTeamChips[0]
669-
) {
670-
// console.log('Yes');
671-
if (teamList[key] === true) {
672-
cntTrue += 1;
669+
if (typeof key === 'string') {
670+
if (this.teamVisible.includes(key)) {
671+
if (taskTeamList[key] === true) {
672+
cntTrue += 1;
673+
}
674+
cntAll += 1;
673675
}
674-
} else {
675-
// console.log('No');
676676
}
677-
678-
cntAll += 1;
677+
// if (
678+
// this.selectedTeamChips[0] === 'All' ||
679+
// key === this.selectedTeamChips[0]
680+
// ) {
681+
// // console.log('Yes');
682+
// if (taskTeamList[key] === true) {
683+
// cntTrue += 1;
684+
// }
685+
// } else {
686+
// // console.log('No');
687+
// }
688+
689+
// cntAll += 1;
679690
}
680691
);
681692
}

0 commit comments

Comments
 (0)