Skip to content

Commit 4a10f1a

Browse files
committed
MOBILE-4345 quiz: Fix sequential navigation
1 parent 685a941 commit 4a10f1a

File tree

1 file changed

+14
-3
lines changed

1 file changed

+14
-3
lines changed

src/addons/mod/quiz/pages/player/player.ts

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -531,6 +531,14 @@ export class AddonModQuizPlayerPage implements OnInit, OnDestroy, CanLeave {
531531
return;
532532
}
533533

534+
// @todo MOBILE-4350: This is called before getting the attempt data in sequential quizzes as a workaround for a bug
535+
// in the LMS. Once the bug has been fixed, this should be reverted.
536+
if (this.isSequential) {
537+
await CoreUtils.ignoreErrors(
538+
AddonModQuiz.logViewAttempt(this.attempt.id, page, this.preflightData, this.offline, this.quiz),
539+
);
540+
}
541+
534542
const data = await AddonModQuiz.getAttemptData(this.attempt.id, page, this.preflightData, {
535543
cmId: this.quiz.coursemodule,
536544
readingStrategy: this.offline ? CoreSitesReadingStrategy.PREFER_CACHE : CoreSitesReadingStrategy.ONLY_NETWORK,
@@ -559,9 +567,12 @@ export class AddonModQuizPlayerPage implements OnInit, OnDestroy, CanLeave {
559567
});
560568

561569
// Mark the page as viewed.
562-
CoreUtils.ignoreErrors(
563-
AddonModQuiz.logViewAttempt(this.attempt.id, page, this.preflightData, this.offline, this.quiz),
564-
);
570+
if (!this.isSequential) {
571+
// @todo MOBILE-4350: Undo workaround.
572+
CoreUtils.ignoreErrors(
573+
AddonModQuiz.logViewAttempt(this.attempt.id, page, this.preflightData, this.offline, this.quiz),
574+
);
575+
}
565576

566577
// Start looking for changes.
567578
this.autoSave.startCheckChangesProcess(this.quiz, this.attempt, this.preflightData, this.offline);

0 commit comments

Comments
 (0)