File tree Expand file tree Collapse file tree 2 files changed +13
-3
lines changed Expand file tree Collapse file tree 2 files changed +13
-3
lines changed Original file line number Diff line number Diff line change 1717 </ div >
1818 </ div >
1919
20- < div class ="window-body_previous-scores ">
20+ < div class ="window-body_previous-scores " *ngIf =" this.previousScores?.size !== 0 " >
2121 < label class ="window-body_previous-scores_title "> Here are your previous results:</ label >
2222 < ul class ="tree-view ">
2323 < li >
24- < ng-container *ngFor ="let keyValue of previousScores! | keyvalue ">
24+ < ng-container *ngFor ="let keyValue of this. previousScores! | keyvalue ">
2525 < details >
2626 < summary > 🗓 Week < b > {{keyValue.key}}</ b > </ summary >
2727 < ul >
Original file line number Diff line number Diff line change @@ -31,7 +31,17 @@ export class AppStorageService {
3131 const currentWeek : number = moment ( ) . isoWeek ( ) ;
3232 const appStorage : AppStorage = this . retrieveAppStorage ( ) ;
3333 const currentWeekScoreMap : Map < number , WeekScore > = appStorage . weekScoreMap ! ;
34- const currentWeekScore : WeekScore = currentWeekScoreMap . get ( currentWeek ) ! ;
34+ let currentWeekScore : WeekScore ;
35+
36+ if ( currentWeekScoreMap . has ( currentWeek ) ) {
37+ currentWeekScore = currentWeekScoreMap . get ( currentWeek ) ! ;
38+ } else {
39+ currentWeekScore = {
40+ score : 0 ,
41+ rightAnswers : 0 ,
42+ wrongAnswers : 0
43+ }
44+ }
3545
3646 if ( correctAnswer ) {
3747 currentWeekScore . rightAnswers += 1 ;
You can’t perform that action at this time.
0 commit comments