Fixes bugs in the additionaldata, the quizmanager and a missing init in the root component.

parent e8a9b3d6
Pipeline #18241 failed with stages
in 2 minutes and 18 seconds
......@@ -42,7 +42,7 @@
<h5 class="text-center">{{'component.quiz_summary.quiz_url' | translate}}</h5>
<p class="mb-0 text-wrap"
role="listitem">
<span>{{quizUrl}}</span>
<span>{{getQuizUrl(this.activeQuestionGroupService.activeQuestionGroup?.hashtag)}}</span>
</p>
</div>
</div>
......
import { DOCUMENT } from '@angular/common';
import { Component, HostListener, Inject } from '@angular/core';
import { IQuestionGroup } from 'arsnova-click-v2-types/src/questions/interfaces';
import { AbstractQuestionGroup } from 'arsnova-click-v2-types/src/questions/questiongroup_abstract';
import { questionGroupReflection } from 'arsnova-click-v2-types/src/questions/questionGroup_reflection';
import { ActiveQuestionGroupService } from '../../service/active-question-group/active-question-group.service';
import { TrackingService } from '../../service/tracking/tracking.service';
......@@ -13,7 +10,6 @@ import { TrackingService } from '../../service/tracking/tracking.service';
})
export class AdditionalDataComponent {
public static TYPE = 'AdditionalDataComponent';
public readonly questionGroupItem: IQuestionGroup;
get quizUrl(): string {
return this._quizUrl;
......@@ -32,18 +28,10 @@ export class AdditionalDataComponent {
private readonly _quizUrl: string;
constructor(@Inject(DOCUMENT) readonly document, public activeQuestionGroupService: ActiveQuestionGroupService, private trackingService: TrackingService) {
this.activeQuestionGroupService.loadData().subscribe(questionGroup => {
if (!(
questionGroup instanceof AbstractQuestionGroup
)) {
questionGroup = questionGroupReflection[questionGroup.TYPE](questionGroup);
}
}
this.questionGroupItem = questionGroup;
if (this.questionGroupItem) {
this._quizUrl = encodeURI(`${document.location.origin}/quiz/${this.questionGroupItem.hashtag}`);
}
});
public getQuizUrl(quizName: string): string {
return encodeURI(`${document.location.origin}/quiz/${quizName}`);
}
public switchShowMoreOrLess(): void {
......
......@@ -2,7 +2,7 @@ import { Component, OnDestroy } from '@angular/core';
import { Router } from '@angular/router';
import { TranslateService } from '@ngx-translate/core';
import { DefaultAnswerOption } from 'arsnova-click-v2-types/src/answeroptions/answeroption_default';
import { IQuestion, IQuestionGroup } from 'arsnova-click-v2-types/src/questions/interfaces';
import { IQuestion } from 'arsnova-click-v2-types/src/questions/interfaces';
import { questionReflection } from 'arsnova-click-v2-types/src/questions/question_reflection';
import { AbstractQuestionGroup } from 'arsnova-click-v2-types/src/questions/questiongroup_abstract';
import { questionGroupReflection } from 'arsnova-click-v2-types/src/questions/questionGroup_reflection';
......@@ -24,8 +24,6 @@ import { TrackingService } from '../../../service/tracking/tracking.service';
export class QuizManagerComponent implements OnDestroy {
public static TYPE = 'QuizManagerComponent';
public questionGroupItem: IQuestionGroup;
private _selectableQuestionTypes = availableQuestionTypes;
get selectableQuestionTypes(): Array<IAvailableQuestionType> {
......@@ -62,7 +60,6 @@ export class QuizManagerComponent implements OnDestroy {
questionGroup = questionGroupReflection[questionGroup.TYPE](questionGroup);
}
this.questionGroupItem = questionGroup;
this.footerBarService.footerElemStartQuiz.isActive = questionGroup.isValid();
});
......@@ -70,7 +67,7 @@ export class QuizManagerComponent implements OnDestroy {
if (!self.isActive) {
return;
}
this.currentQuizService.quiz = this.questionGroupItem;
this.currentQuizService.quiz = this.activeQuestionGroupService.activeQuestionGroup;
await this.currentQuizService.cacheQuiz();
await this.lobbyApiService.putLobby({
quiz: this.currentQuizService.quiz.serialize(),
......
......@@ -126,7 +126,9 @@ export class RootComponent implements OnInit, AfterViewInit {
private async getTooltipForRoute(route: string): Promise<void> {
let hasStartedIntroJs = false;
const introState = await this.storageService.read(DB_TABLE.CONFIG, STORAGE_KEY.INTRO_STATE).toPromise();
const introState = (
await this.storageService.read(DB_TABLE.CONFIG, STORAGE_KEY.INTRO_STATE).toPromise()
) || {};
if (window.innerWidth <= 768) {
return;
}
......
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