Skip to content

Commit 68951ef

Browse files
authored
Merge pull request #336 from 0x41head/activity-desc
Fixed bug where changes done in circular heatmap were not shown in activity description
2 parents ffccf07 + bbb5975 commit 68951ef

File tree

2 files changed

+39
-16
lines changed

2 files changed

+39
-16
lines changed

src/app/component/activity-description/activity-description.component.ts

Lines changed: 31 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ export interface implementation {
1010
url: string;
1111
description: string;
1212
}
13+
1314
export interface activityDescription {
1415
dimension: string;
1516
subDimension: string;
@@ -127,19 +128,6 @@ export class ActivityDescriptionComponent implements OnInit {
127128
var currentActivityName = activityInCurrentSubDimension[a];
128129

129130
try {
130-
console.log(this.currentActivity.uuid, this.currentActivity.uuid);
131-
console.log(
132-
'uuid',
133-
this.YamlObject[allDimensionNames[i]][
134-
subdimensionsInCurrentDimension[j]
135-
][currentActivityName].uuid
136-
);
137-
console.log(
138-
'currentActivityName',
139-
this.YamlObject[allDimensionNames[i]][
140-
subdimensionsInCurrentDimension[j]
141-
][currentActivityName]
142-
);
143131
if (
144132
this.YamlObject[allDimensionNames[i]][
145133
subdimensionsInCurrentDimension[j]
@@ -149,7 +137,7 @@ export class ActivityDescriptionComponent implements OnInit {
149137
this.YamlObject[allDimensionNames[i]][
150138
subdimensionsInCurrentDimension[j]
151139
][currentActivityName];
152-
this.currentActivity = data;
140+
this.currentActivity = JSON.parse(JSON.stringify(data)); // Creates a deep copy of current activity to keep two seperate versions - with and without martkdown
153141
this.currentActivity.dimension = allDimensionNames[i];
154142
this.currentActivity.subDimension =
155143
subdimensionsInCurrentDimension[j];
@@ -262,7 +250,35 @@ export class ActivityDescriptionComponent implements OnInit {
262250
data['isImplemented'],
263251
false
264252
);
265-
this.currentActivity.teamsImplemented = data['teamsImplemented'];
253+
const dataFromLocalStorage = localStorage.getItem('dataset');
254+
if (dataFromLocalStorage !== null) {
255+
var parsedDataFromLocalStorage = JSON.parse(dataFromLocalStorage);
256+
var index = -1;
257+
for (var i = 0; i < parsedDataFromLocalStorage.length; i++) {
258+
for (
259+
var j = 0;
260+
j < parsedDataFromLocalStorage[i]['Activity'].length;
261+
j++
262+
) {
263+
if (
264+
parsedDataFromLocalStorage[i]['Activity'][j]['uuid'] ===
265+
data['uuid']
266+
) {
267+
console.log('test', parsedDataFromLocalStorage[i]['Activity'][j]);
268+
269+
index = i;
270+
this.currentActivity.teamsImplemented =
271+
parsedDataFromLocalStorage[i]['Activity'][j][
272+
'teamsImplemented'
273+
];
274+
275+
break;
276+
}
277+
}
278+
}
279+
// this.currentActivity.teamsEvidence = this.defineEvidenceObject();
280+
} else this.currentActivity.teamsImplemented = data['teamsImplemented'];
281+
266282
this.currentActivity.teamsEvidence = this.defineEvidenceObject(
267283
data['teamsEvidence']
268284
);

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

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ import { Router } from '@angular/router';
1212
import { MatChip } from '@angular/material/chips';
1313

1414
export interface activitySchema {
15+
uuid: string;
1516
activityName: string;
1617
teamsImplemented: any;
1718
}
@@ -101,6 +102,11 @@ export class CircularHeatmapComponent implements OnInit {
101102

102103
for (var a = 0; a < allActivityInThisSubDimension.length; a++) {
103104
try {
105+
var uuid =
106+
this.YamlObject[allDimensionNames[d]][
107+
allSubDimensionInThisDimension[s]
108+
][allActivityInThisSubDimension[a]]['uuid'];
109+
104110
var lvlOfCurrentActivity =
105111
this.YamlObject[allDimensionNames[d]][
106112
allSubDimensionInThisDimension[s]
@@ -148,6 +154,7 @@ export class CircularHeatmapComponent implements OnInit {
148154
});
149155

150156
activity.push({
157+
uuid: uuid,
151158
activityName: nameOfActivity,
152159
teamsImplemented: teamStatus,
153160
});
@@ -788,7 +795,7 @@ export class CircularHeatmapComponent implements OnInit {
788795

789796
ResetIsImplemented() {
790797
localStorage.removeItem('dataset');
791-
this.loadState()
798+
this.loadState();
792799
}
793800

794801
saveState() {

0 commit comments

Comments
 (0)