Commit c02e6c45 authored by Christopher Fullarton's avatar Christopher Fullarton

Fixes counting anonymous quiz responses during the active countdown

parent 9ba53f73
Pipeline #34539 passed with stages
in 15 minutes and 27 seconds
......@@ -2,7 +2,7 @@
<app-progress-bar-anonymous [attendeeData]="attendeeDataForAnswer()"
[type]="question?.TYPE"></app-progress-bar-anonymous>
</ng-container>
<ng-container *ngIf="!hideProgressbarCssStyle">
<ng-container *ngIf="!hideProgressbarCssStyle && data">
<ng-container *ngFor="let answer of data; let i = index">
<app-progress-bar-single-choice *ngIf="question?.TYPE === 'SingleChoiceQuestion'"
[attendeeData]="attendeeDataForAnswer(i)"></app-progress-bar-single-choice>
......
......@@ -73,7 +73,7 @@ export class ProgressBarComponent {
return false;
}
const responseValue: Array<number> | string = value.responses[this.questionIndex].value;
if (!Array.isArray(responseValue) || !['number', 'string'].includes(typeof responseValue)) {
if (!Array.isArray(responseValue) && !['number', 'string'].includes(typeof responseValue)) {
return false;
}
......@@ -85,11 +85,10 @@ export class ProgressBarComponent {
wrong++;
}
} else if (question.TYPE === QuestionType.RangedQuestion) {
const parsedResponseValue = parseInt(responseValue as unknown as string, 10);
if (parsedResponseValue === question.correctValue || //
if (responseValue === question.correctValue || //
(
parsedResponseValue >= question.rangeMin && //
parsedResponseValue <= question.rangeMax
responseValue >= question.rangeMin && //
responseValue <= question.rangeMax
)) {
correct++;
} else {
......@@ -103,14 +102,18 @@ export class ProgressBarComponent {
question.answerOptionList.forEach((answer, answerIndex) => {
if (answer.isCorrect) {
if ((
responseValue.indexOf(answerIndex)
(
responseValue as unknown as Array<string>
).indexOf(answerIndex)
) > -1) {
correct++;
base++;
}
} else {
if ((
responseValue.indexOf(answerIndex)
(
responseValue as unknown as Array<string>
).indexOf(answerIndex)
) > -1) {
wrong++;
base++;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment