Skip to content

Commit 7b4cf29

Browse files
committed
Export only genuine teams to new yaml file
1 parent 52533de commit 7b4cf29

2 files changed

Lines changed: 24 additions & 2 deletions

File tree

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -289,7 +289,7 @@ <h2>Nothing to show</h2>
289289
class="normal-button"
290290
mat-raised-button
291291
class="downloadButtonClass"
292-
(click)="SaveEditedYAMLfile()">
292+
(click)="saveEditedYAMLfile()">
293293
Download edited YAML file
294294
</button>
295295
<button

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

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -739,8 +739,10 @@ export class CircularHeatmapComponent implements OnInit {
739739
this.showOverlay = false;
740740
}
741741

742-
SaveEditedYAMLfile() {
742+
saveEditedYAMLfile() {
743+
this.setTeamsStatus(this.YamlObject, this.teamList, this.ALL_CARD_DATA);
743744
let yamlStr = yaml.dump(this.YamlObject);
745+
744746
let file = new Blob([yamlStr], { type: 'text/csv;charset=utf-8' });
745747
var link = document.createElement('a');
746748
link.href = window.URL.createObjectURL(file);
@@ -749,6 +751,26 @@ export class CircularHeatmapComponent implements OnInit {
749751
link.remove();
750752
}
751753

754+
setTeamsStatus(yamlObject: any, teamList: string[], card_data: cardSchema[]) {
755+
// Loop through all activities from the card_data
756+
for (let card of card_data) {
757+
for (let activity of card.Activity) {
758+
let dim: string = card.Dimension;
759+
let subdim: string = card.SubDimension;
760+
let activityName: string = activity.activityName;
761+
let teamsImplemented: any = {};
762+
763+
// Get the state for all genuine teams of the activity
764+
for (let team of teamList) {
765+
teamsImplemented[team] = activity?.teamsImplemented[team] || false;
766+
}
767+
// Save the teams' state to the yaml object
768+
yamlObject[dim][subdim][activityName].teamsImplemented =
769+
teamsImplemented;
770+
}
771+
}
772+
}
773+
752774
reColorHeatmap() {
753775
console.log('recolor');
754776
for (var index = 0; index < this.ALL_CARD_DATA.length; index++) {

0 commit comments

Comments
 (0)