MOBILE-4263 quiz: Avoid 'activerulenames' of undefined error

main
Dani Palou 2023-03-02 10:53:33 +01:00
parent 7cd9f6172c
commit 4792e47737
1 changed files with 74 additions and 80 deletions

View File

@ -332,7 +332,6 @@ export class AddonModQuizPlayerPage implements OnInit, OnDestroy, CanLeave {
* @returns Promise resolved when done. * @returns Promise resolved when done.
*/ */
protected async fetchData(): Promise<void> { protected async fetchData(): Promise<void> {
try {
this.quiz = await AddonModQuiz.getQuiz(this.courseId, this.cmId); this.quiz = await AddonModQuiz.getQuiz(this.courseId, this.cmId);
// Block the quiz so it cannot be synced. // Block the quiz so it cannot be synced.
@ -385,9 +384,6 @@ export class AddonModQuizPlayerPage implements OnInit, OnDestroy, CanLeave {
); );
this.newAttempt = AddonModQuiz.isAttemptFinished(this.lastAttempt.state); this.newAttempt = AddonModQuiz.isAttemptFinished(this.lastAttempt.state);
} catch (error) {
CoreDomUtils.showErrorModalDefault(error, 'addon.mod_quiz.errorgetquiz', true);
}
} }
/** /**
@ -722,6 +718,8 @@ export class AddonModQuizPlayerPage implements OnInit, OnDestroy, CanLeave {
// Quiz data has been loaded, try to start or continue. // Quiz data has been loaded, try to start or continue.
await this.startOrContinueAttempt(); await this.startOrContinueAttempt();
} catch (error) {
CoreDomUtils.showErrorModalDefault(error, 'addon.mod_quiz.errorgetquiz', true);
} finally { } finally {
this.loaded = true; this.loaded = true;
} }
@ -733,7 +731,6 @@ export class AddonModQuizPlayerPage implements OnInit, OnDestroy, CanLeave {
* @returns Promise resolved when done. * @returns Promise resolved when done.
*/ */
protected async startOrContinueAttempt(): Promise<void> { protected async startOrContinueAttempt(): Promise<void> {
try {
let attempt = this.newAttempt ? undefined : this.lastAttempt; let attempt = this.newAttempt ? undefined : this.lastAttempt;
// Get the preflight data and start attempt if needed. // Get the preflight data and start attempt if needed.
@ -766,9 +763,6 @@ export class AddonModQuizPlayerPage implements OnInit, OnDestroy, CanLeave {
// Attempt is overdue or finished in offline, we can only load the summary. // Attempt is overdue or finished in offline, we can only load the summary.
await this.loadSummary(); await this.loadSummary();
} }
} catch (error) {
CoreDomUtils.showErrorModalDefault(error, 'addon.mod_quiz.errorgetquestions', true);
}
} }
/** /**