diff --git a/client/src/app/class/_services/dashboard.service.ts b/client/src/app/class/_services/dashboard.service.ts index 1c78f9008..387ce1c54 100644 --- a/client/src/app/class/_services/dashboard.service.ts +++ b/client/src/app/class/_services/dashboard.service.ts @@ -242,7 +242,7 @@ export class DashboardService { if (item) { itemCount = item.inputs.length; - customScore = !isNaN(item.customScore)? item.customScore: null + customScore = item.customScore? item.customScore: null const metadata = item.metadata; if (metadata) { lastModified = metadata['lastModified']; @@ -388,8 +388,8 @@ export class DashboardService { maxValueAnswer = maxValueAnswer + max; } score = totalCorrect; - scorePercentageCorrect = !isNaN(customScore) ? customScore : this.classUtils.round(totalCorrect / maxValueAnswer * 100, 2); - if (!isNaN(customScore)) { + scorePercentageCorrect = customScore ? customScore : this.classUtils.round(totalCorrect / maxValueAnswer * 100, 2); + if (customScore) { maxValueAnswer = 100 } } @@ -430,7 +430,7 @@ export class DashboardService { totalIncorrect: totalIncorrect, maxValueAnswer: maxValueAnswer, totalCorrect: totalCorrect, - scorePercentageCorrect: !isNaN(customScore) ? customScore : scorePercentageCorrect, + scorePercentageCorrect: customScore ? customScore : scorePercentageCorrect, duration: duration, customScore: customScore }; @@ -503,15 +503,15 @@ export class DashboardService { studentResults.score = score; // console.log("student: " + studentResults["name"] + " form item: " + studentResults["response"]["formTitle"] + " score: " + score) } - const max = !isNaN(studentResponse.customScore)? 100: studentResponse.max; + const max = studentResponse.customScore? 100: studentResponse.max; if (max) { studentResults.max = max; classGroupReportMax = max; } - const totalCorrect = !isNaN(studentResponse.customScore) ? studentResponse.customScore : studentResponse.totalCorrect; - const scorePercentageCorrect = !isNaN(studentResponse.customScore) ? studentResponse.customScore : studentResponse.scorePercentageCorrect; + const totalCorrect = studentResponse.customScore ? studentResponse.customScore : studentResponse.totalCorrect; + const scorePercentageCorrect = studentResponse.customScore ? studentResponse.customScore : studentResponse.scorePercentageCorrect; studentResults.scorePercentageCorrect = scorePercentageCorrect; - const maxValueAnswer = !isNaN(studentResponse.customScore) ? 100: studentResponse.maxValueAnswer; + const maxValueAnswer = studentResponse.customScore ? 100: studentResponse.maxValueAnswer; studentResults.maxValueAnswer = maxValueAnswer; studentResults.customScore = studentResponse.customScore duration = studentResponse.duration;