Fixes starting the quiz with the button in the home component if the quiz is valid

parent bed25906
Pipeline #18391 passed with stages
in 10 minutes and 57 seconds
......@@ -74,8 +74,8 @@
id="startSession"
class="btn btn-success btn-block pointer"
(click)="handleClick('startSession') && setAsCurrentQuiz(['/quiz', 'flow'])"
[class.disabled]="!canStartQuiz || !serverPassword.length"
[disabled]="!canStartQuiz || !serverPassword.length">
[class.disabled]="!canStartQuiz || (passwordRequired && !serverPassword.length)"
[disabled]="!canStartQuiz || (passwordRequired && !serverPassword.length)">
<i class="fas fa-thumbs-up"></i>
<span class="ml-1">{{'component.hashtag_management.start_session' | translate}}</span>
</button>
......
......@@ -140,15 +140,6 @@ export class HomeComponent implements OnInit, OnDestroy {
this.connectionService.socket.subscribe(data => {
this.connectionService.websocketAvailable = true;
switch (data.step) {
case COMMUNICATION_PROTOCOL.QUIZ.SET_ACTIVE:
this.sharedService.activeQuizzes.push(data.payload.quizName);
break;
case COMMUNICATION_PROTOCOL.QUIZ.SET_INACTIVE:
const index = this.sharedService.activeQuizzes.findIndex(name => name === data.payload.quizName);
this.sharedService.activeQuizzes.splice(index, 1);
}
}, () => this.connectionService.websocketAvailable = false);
});
}
......@@ -414,6 +405,7 @@ export class HomeComponent implements OnInit, OnDestroy {
private async selectQuizAsExisting(quizname): Promise<void> {
const currentQuiz = await this.storageService.read(DB_TABLE.QUIZ, quizname).toPromise();
const questionGroupInstance = questionGroupReflection[currentQuiz.TYPE](currentQuiz);
this.canAddQuiz = false;
this.canEditQuiz = true;
this.canStartQuiz = !this.settingsService.serverSettings.createQuizPasswordRequired && questionGroupInstance.isValid();
......
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