Commit e9081a42 authored by Christopher Fullarton's avatar Christopher Fullarton

Fixes some ui bugs

parent 37a8f34c
......@@ -254,11 +254,11 @@ export class QuizLobbyComponent implements OnInit, OnDestroy, IHasTriggeredNavig
const promise = this.attendeeService.attendees.length ? this.ngbModal.open(EditModeConfirmComponent).result : new Promise<any>(
resolve => resolve());
promise.then(() => {
this.quizService.close();
this.attendeeService.cleanUp();
this.connectionService.cleanUp();
this.hasTriggeredNavigation = true;
this.router.navigate(['/quiz', 'manager', 'overview']);
this.router.navigate(['/quiz', 'manager', 'overview']).then(() => {
this.quizService.close();
this.attendeeService.cleanUp();
});
}).catch(() => {});
};
}
......
......@@ -61,6 +61,7 @@ export class CountdownComponent implements OnInit, OnDestroy {
set countdown(value: string) {
this._countdown = value;
this.updateCountdown(parseInt(value, 10));
}
private _questionIndex: number;
......@@ -96,7 +97,7 @@ export class CountdownComponent implements OnInit, OnDestroy {
this._plainMinutes = parseInt(this._parsedMinutes, 10);
this._plainSeconds = parseInt(this._parsedSeconds, 10);
this.quizService.quiz.questionList[this._questionIndex].timer = parseInt(this.countdown, 10) || 0;
this.quizService.quiz.questionList[this._questionIndex].timer = countdown || 0;
}
public ngOnInit(): void {
......
......@@ -79,6 +79,7 @@ export class QuizOverviewComponent implements OnInit {
const quizAvailable = await this.requestQuizStatus(elem);
if (!quizAvailable) {
this.isStartingQuiz = null;
resolve();
return;
}
......
......@@ -534,11 +534,11 @@ export class HomeComponent implements OnInit, OnDestroy {
return;
}
const hasMatchedABCDQuiz = this.ownQuizzes.filter(quizName => {
return quizName.split(' ')[0] === this.enteredSessionName;
const hasMatchedABCDQuiz = this.ownQuizzes.find(quizName => {
return quizName.toLowerCase().trim().split(' ')[0] === this.enteredSessionName.toLowerCase().trim();
});
if (hasMatchedABCDQuiz.length) {
const questionGroup = await this.storageService.db.Quiz.get(hasMatchedABCDQuiz[0]);
if (hasMatchedABCDQuiz) {
const questionGroup = await this.storageService.db.Quiz.get(hasMatchedABCDQuiz);
const answerOptionList = (<Array<AbstractAnswerEntity>>[]);
answerList.forEach((character, index) => {
......
......@@ -7,7 +7,6 @@ import { QuizState } from '../../lib/enums/QuizState';
import { IMemberSerialized } from '../../lib/interfaces/entities/Member/IMemberSerialized';
import { IQuizResponse } from '../../lib/interfaces/quizzes/IQuizResponse';
import { MemberApiService } from '../api/member/member-api.service';
import { FooterBarService } from '../footer-bar/footer-bar.service';
import { QuizService } from '../quiz/quiz.service';
import { StorageService } from '../storage/storage.service';
......@@ -36,7 +35,6 @@ export class AttendeeService {
constructor(
@Inject(PLATFORM_ID) private platformId: Object,
private footerBarService: FooterBarService,
private quizService: QuizService,
private storageService: StorageService,
private memberApiService: MemberApiService,
......@@ -145,7 +143,6 @@ export class AttendeeService {
this._attendees = data.payload.members.map((attendee) => {
return new Attendee(attendee);
});
this.footerBarService.footerElemStartQuiz.isActive = this._attendees.length > 0;
resolve();
}, () => reject());
});
......@@ -157,7 +154,6 @@ export class AttendeeService {
if (!quiz || typeof quiz.state === 'undefined' || quiz.state === QuizState.Inactive) {
return;
}
this.footerBarService.footerElemStartQuiz.isActive = this._attendees.length > 0;
console.log('AttendeeService#loadData', 'quiz set', quiz);
this.restoreMembers();
......
......@@ -4,7 +4,7 @@ import { ActivatedRoute } from '@angular/router';
import { TranslateService } from '@ngx-translate/core';
import { RxStompService } from '@stomp/ng2-stompjs';
import { RxStompState } from '@stomp/rx-stomp';
import { filter } from 'rxjs/operators';
import { filter, switchMapTo } from 'rxjs/operators';
import { environment } from '../../../environments/environment';
import { DefaultSettings } from '../../lib/default.settings';
import { StorageKey } from '../../lib/enums/enums';
......@@ -12,6 +12,7 @@ import { StatusProtocol } from '../../lib/enums/Message';
import { FooterbarElement } from '../../lib/footerbar-element/footerbar-element';
import { IFooterBarElement } from '../../lib/footerbar-element/interfaces';
import { QuizApiService } from '../api/quiz/quiz-api.service';
import { AttendeeService } from '../attendee/attendee.service';
import { QuizService } from '../quiz/quiz.service';
import { UserService } from '../user/user.service';
......@@ -415,18 +416,16 @@ export class FooterBarService {
@Inject(PLATFORM_ID) private platformId: Object,
private userService: UserService,
private rxStompService: RxStompService,
private quizService: QuizService,
private quizService: QuizService, private attendeeService: AttendeeService,
private quizApiService: QuizApiService,
private translateService: TranslateService, private route: ActivatedRoute, private injector: Injector,
) {
this.rxStompService.connectionState$.subscribe(value => {
this.quizService.quizUpdateEmitter.pipe(filter(quiz => !!quiz), switchMapTo(this.rxStompService.connectionState$)).subscribe(value => {
this._connectionState = value;
this.toggleFooterElemState(value === RxStompState.OPEN);
});
this.quizService.quizUpdateEmitter.pipe(filter(quiz => !!quiz)).subscribe(() => {
this.updateFooterElementsState();
// this.toggleFooterElemState(value === RxStompState.OPEN && ([QuizState.Inactive].includes(this.quizService.quiz.state) ||
// this.attendeeService.attendees.length > 0));
});
}
......
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