Commit f963ea4b authored by Christopher Fullarton's avatar Christopher Fullarton

Improves the logic when the warning dialog in the quiz flow is shown. Closes...

Improves the logic when the warning dialog in the quiz flow is shown. Closes the availablequizzes dialog in the home component on navigation
parent 0d2074a6
Pipeline #33538 passed with stages
in 16 minutes and 2 seconds
......@@ -77,7 +77,7 @@ export class ConfidenceRateComponent implements OnInit, OnDestroy, IHasTriggered
this.quizService.loadDataToPlay(sessionStorage.getItem(StorageKey.CurrentQuizName)).then(() => {
this.handleMessages();
});
}).catch(() => this.hasTriggeredNavigation = true);
this.connectionService.serverStatusEmitter.pipe(takeUntil(this._destroy)).subscribe(isConnected => {
if (isConnected) {
......
......@@ -102,7 +102,7 @@ export class LeaderboardComponent implements OnInit, OnDestroy, IHasTriggeredNav
this.quizService.loadDataToPlay(sessionStorage.getItem(StorageKey.CurrentQuizName)).then(() => {
this.handleMessages();
});
}).catch(() => this.hasTriggeredNavigation = true);
this.connectionService.serverStatusEmitter.pipe(takeUntil(this._destroy)).subscribe(isConnected => {
if (isConnected) {
......
......@@ -100,7 +100,7 @@ export class QuizLobbyComponent implements OnInit, OnDestroy, IHasTriggeredNavig
});
this.quizService.loadDataToPlay(sessionStorage.getItem(StorageKey.CurrentQuizName)).then(() => {
});
}).catch(() => this.hasTriggeredNavigation = true);
this.connectionService.serverStatusEmitter.pipe(takeUntil(this._destroy)).subscribe(isConnected => {
if (isConnected) {
......
......@@ -140,7 +140,7 @@ export class QuestionDetailsComponent implements OnInit, OnDestroy, IHasTriggere
this.quizService.loadDataToPlay(sessionStorage.getItem(StorageKey.CurrentQuizName)).then(() => {
this.handleMessages();
});
}).catch(() => this.hasTriggeredNavigation = true);
}
public ngOnDestroy(): void {
......
......@@ -247,7 +247,7 @@ export class QuizResultsComponent implements OnInit, OnDestroy, IHasTriggeredNav
this.quizService.loadDataToPlay(sessionStorage.getItem(StorageKey.CurrentQuizName)).then(() => {
this.handleMessages();
this.questionTextService.change(this.quizService.currentQuestion().questionText).then(() => this.cd.markForCheck());
});
}).catch(() => this.hasTriggeredNavigation = true);
this.connectionService.serverStatusEmitter.pipe(takeUntil(this._destroy)).subscribe(isConnected => {
if (isConnected) {
......
......@@ -100,7 +100,7 @@ export class ReadingConfirmationComponent implements OnInit, OnDestroy, IHasTrig
this.quizService.loadDataToPlay(sessionStorage.getItem(StorageKey.CurrentQuizName)).then(() => {
this.handleMessages();
});
}).catch(() => this.hasTriggeredNavigation = true);
this.questionTextService.eventEmitter.pipe(takeUntil(this._destroy)).subscribe((value: string) => {
this.questionText = value;
......
......@@ -198,7 +198,7 @@ export class VotingComponent implements OnInit, OnDestroy, IHasTriggeredNavigati
this.quizService.loadDataToPlay(sessionStorage.getItem(StorageKey.CurrentQuizName)).then(() => {
this.handleMessages();
});
}).catch(() => this.hasTriggeredNavigation = true);
this.connectionService.serverStatusEmitter.pipe(takeUntil(this._destroy)).subscribe(isConnected => {
if (isConnected) {
......
......@@ -4,7 +4,6 @@ import { NgbModal } from '@ng-bootstrap/ng-bootstrap';
import { TranslateService } from '@ngx-translate/core';
import { Subject } from 'rxjs';
import { environment } from '../../../../environments/environment';
import { availableQuestionTypes, IAvailableQuestionType } from '../../../lib/available-question-types';
import { DefaultAnswerEntity } from '../../../lib/entities/answer/DefaultAnswerEntity';
import { ABCDSingleChoiceQuestionEntity } from '../../../lib/entities/question/ABCDSingleChoiceQuestionEntity';
import { TrueFalseSingleChoiceQuestionEntity } from '../../../lib/entities/question/TrueFalseSingleChoiceQuestionEntity';
......@@ -29,12 +28,6 @@ import { QuizTypeSelectModalComponent } from './quiz-type-select-modal/quiz-type
export class QuizManagerComponent implements OnInit, OnDestroy {
public static TYPE = 'QuizManagerComponent';
private _selectableQuestionTypes = availableQuestionTypes;
get selectableQuestionTypes(): Array<IAvailableQuestionType> {
return this._selectableQuestionTypes;
}
private readonly _destroy = new Subject();
constructor(
......
......@@ -150,7 +150,8 @@ export class HomeComponent implements OnInit, OnDestroy {
if (this._ownQuizzes.length && //
environment.showJoinableQuizzes && //
(!environment.requireLoginToCreateQuiz || this.userService.isAuthorizedFor(UserRole.CreateQuiz))) {
this.modalService.open(AvailableQuizzesComponent);
const ref = this.modalService.open(AvailableQuizzesComponent);
this._destroy.subscribe(() => ref.close());
}
});
......
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