Commit 3f2cfc81 authored by Christopher Fullarton's avatar Christopher Fullarton

Fixes access to the response data if the member is not yet initialized

parent 6c787e0b
Pipeline #33909 passed with stages
in 14 minutes and 56 seconds
......@@ -101,6 +101,10 @@ export class AttendeeService {
}
public hasReponse(): boolean {
if (!this.getMember(this.ownNick)) {
return;
}
const response = this.getMember(this.ownNick).responses[this.quizService.quiz.currentQuestionIndex];
if (typeof response === 'undefined' || typeof response.value === 'undefined') {
return false;
......@@ -114,11 +118,19 @@ export class AttendeeService {
}
public hasReadingConfirmation(): boolean {
if (!this.getMember(this.ownNick)) {
return;
}
const response = this.getMember(this.ownNick).responses[this.quizService.quiz.currentQuestionIndex];
return response && response.readingConfirmation;
}
public hasConfidenceValue(): boolean {
if (!this.getMember(this.ownNick)) {
return;
}
const response = this.getMember(this.ownNick).responses[this.quizService.quiz.currentQuestionIndex];
return response && !isNaN(response.confidence);
}
......
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