From e3fdd3b0fafe1988e1f19346b11b18a5b4274072 Mon Sep 17 00:00:00 2001 From: ShounakB <65479699+Shounaks@users.noreply.github.com> Date: Sat, 23 Nov 2024 00:46:19 +1100 Subject: [PATCH] Fixing updateGrade Method --- src/app/common/grade-icon/grade-icon.component.ts | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/src/app/common/grade-icon/grade-icon.component.ts b/src/app/common/grade-icon/grade-icon.component.ts index d90bc6298..5f8f31c7b 100644 --- a/src/app/common/grade-icon/grade-icon.component.ts +++ b/src/app/common/grade-icon/grade-icon.component.ts @@ -11,7 +11,7 @@ export class GradeIconComponent implements OnInit, OnChanges { @Input() grade?: number | string; @Input() colorful: boolean = false; - gradeText: number | string = 'Grade'; + gradeText: string = 'Grade'; gradeLetter: string = 'G'; constructor(private gradeService: GradeService) {} @@ -27,10 +27,9 @@ export class GradeIconComponent implements OnInit, OnChanges { } private updateGrade(): void { - this.gradeText = - typeof this.grade === 'string' - ? this.gradeService.stringToGrade(this.grade) - : this.gradeService.grades[this.grade] || 'Grade'; - this.gradeLetter = this.gradeService.gradeAcronyms[this.grade] || 'G'; + const grade: number = + typeof this.grade === 'string' ? this.gradeService.stringToGrade(this.grade) : this.grade; + this.gradeText = this.gradeService.grades[grade] || 'Grade'; + this.gradeLetter = this.gradeService.gradeAcronyms[grade] || 'G'; } }