Skip to content

Commit b08900f

Browse files
committed
Linting
1 parent 62240bb commit b08900f

File tree

1 file changed

+35
-29
lines changed

1 file changed

+35
-29
lines changed

src/app/model/progress-store.ts

Lines changed: 35 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -422,36 +422,42 @@ export class ProgressStore {
422422
let stored = localStorage.getItem('dataset');
423423
let completeTitle: ProgressTitle = this.getCompletedProgressTitle();
424424
if (stored) {
425-
try {
426-
const legacyDataset = JSON.parse(stored);
427-
428-
legacyDataset.forEach((entry: any) => {
429-
const legacyActivities = entry.Activity;
430-
431-
if (Array.isArray(legacyActivities)) {
432-
legacyActivities.forEach((legacyActivity: any) => {
433-
const activityUuid = legacyActivity.uuid;
434-
const teamsImplemented = legacyActivity.teamsImplemented;
435-
if (teamsImplemented) {
436-
Object.keys(teamsImplemented).forEach((team: string) => {
437-
if (legacyActivity.teamsImplemented[team]) {
438-
if (!progress![activityUuid]) {
439-
progress![activityUuid] = {};
440-
}
441-
if (!progress![activityUuid][team]) {
442-
progress![activityUuid][team] = {};
443-
}
444-
console.log(`Legacy import: Setting '${completeTitle}' on ${activityUuid} for ${team}`);
445-
progress![activityUuid][team][completeTitle] = new Date();
446-
}
447-
});
448-
}
449-
});
450-
}
425+
try {
426+
const legacyDataset = JSON.parse(stored);
427+
428+
legacyDataset.forEach((entry: any) => {
429+
const legacyActivities = entry.Activity;
430+
431+
if (Array.isArray(legacyActivities)) {
432+
legacyActivities.forEach((legacyActivity: any) => {
433+
const activityUuid = legacyActivity.uuid;
434+
const teamsImplemented = legacyActivity.teamsImplemented;
435+
if (teamsImplemented) {
436+
Object.keys(teamsImplemented).forEach((team: string) => {
437+
if (legacyActivity.teamsImplemented[team]) {
438+
if (!progress![activityUuid]) {
439+
progress![activityUuid] = {};
440+
}
441+
if (!progress![activityUuid][team]) {
442+
progress![activityUuid][team] = {};
443+
}
444+
console.log(`Legacy import: Setting '${completeTitle}' on ${activityUuid} for ${team}`); // eslint-disable-line
445+
progress![activityUuid][team][completeTitle] = new Date();
446+
}
447+
});
448+
}
451449
});
452-
} catch (error) {
453-
console.error("Failed to parse legacy dataset", error);
454-
}
450+
}
451+
});
452+
} catch (error) {
453+
console.error('Failed to parse legacy progress: ', error);
454+
throw Error(
455+
'Failed to parse legacy DSOMM team progress.' +
456+
' You may attempt fixing or clearing your browser storage and try again.' +
457+
'\n\nThe localStorage `dataset` gives the error: \n\n' +
458+
error
459+
);
460+
}
455461
}
456462
return progressFile;
457463
}

0 commit comments

Comments
 (0)