Commit 8be4e759 authored by Christopher Mark Fullarton's avatar Christopher Mark Fullarton
Browse files

Improves performance of the quiz results. Adds question text to the quiz...

Improves performance of the quiz results. Adds question text to the quiz results if a question with reading confirmation is currently active. Fixes questions without a countdown
parent f0f466fb
......@@ -75,7 +75,7 @@ export abstract class AbstractQuestionEntity {
const questionTextWithoutMarkdownChars = this.getQuestionTextWithoutMarkdownChars().length;
// hard coded checkup values are ugly, but the schema import seems to be messed up here...
return answerOptionListValid && questionTextWithoutMarkdownChars > 4 && questionTextWithoutMarkdownChars < 50001 && this.timer >= 0;
return answerOptionListValid && questionTextWithoutMarkdownChars > 4 && questionTextWithoutMarkdownChars < 50001 && this.timer >= -1;
}
public getQuestionTextWithoutMarkdownChars(): string {
......
......@@ -196,6 +196,8 @@ export class QuizEntity extends AbstractEntity implements IQuizEntity {
status: StatusProtocol.Success,
step: MessageProtocol.Stop,
}));
this.currentStartTimestamp = -1;
clearTimeout(this._quizTimerInterval);
}
public addSocketToChannel(socket: WebSocket): void {
......@@ -322,6 +324,9 @@ export class QuizEntity extends AbstractEntity implements IQuizEntity {
}));
this._quizTimer = this._questionList[this._currentQuestionIndex].timer;
if (this._quizTimer === -1) {
return;
}
this._quizTimerInterval = setInterval(() => {
this._quizTimer--;
......
......@@ -608,6 +608,7 @@ export class QuizRouter extends AbstractRouter {
state: QuizState.Active,
currentQuestionIndex: -1,
currentStartTimestamp: -1,
readingConfirmationRequested: false,
});
const members = MemberDAO.getMembersOfQuiz(quizName);
......
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