Skip to content

Commit

Permalink
Merge pull request #3745 from Tangerine-Community/fix-regular-scoring
Browse files Browse the repository at this point in the history
fix(scoring): Fix for regular scoring to use actual maxValueAnswer
  • Loading branch information
esurface authored Nov 18, 2024
2 parents 9a03e78 + 50d8985 commit 12c8e05
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions client/src/app/class/_services/dashboard.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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'];
Expand Down Expand Up @@ -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
}
}
Expand Down Expand Up @@ -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
};
Expand Down Expand Up @@ -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;
Expand Down

0 comments on commit 12c8e05

Please sign in to comment.