diff --git a/scripts/langindex.json b/scripts/langindex.json index 4a31ebf4178..272d14f62e8 100644 --- a/scripts/langindex.json +++ b/scripts/langindex.json @@ -1148,9 +1148,22 @@ "addon.privatefiles.files": "moodle", "addon.privatefiles.privatefiles": "moodle", "addon.privatefiles.sitefiles": "moodle", + "addon.qtype_ddimageortext.pleasedraganimagetoeachdropregion": "qtype_ddimageortext", + "addon.qtype_ddmarker.pleasedragatleastonemarker": "qtype_ddmarker", "addon.qtype_essay.maxwordlimitboundary": "qtype_essay", "addon.qtype_essay.minwordlimitboundary": "qtype_essay", + "addon.qtype_gapselect.pleaseputananswerineachbox": "qtype_gapselect", + "addon.qtype_match.pleaseananswerallparts": "qtype_match", + "addon.qtype_multianswer.pleaseananswerallparts": "qtype_multianswer", + "addon.qtype_multichoice.pleaseselectananswer": "qtype_multichoice", + "addon.qtype_multichoice.pleaseselectatleastoneanswer": "qtype_multichoice", + "addon.qtype_numerical.invalidnumber": "qtype_numerical", + "addon.qtype_numerical.invalidnumbernounit": "qtype_numerical", + "addon.qtype_numerical.pleaseenterananswer": "qtype_numerical", + "addon.qtype_numerical.unitnotselected": "qtype_numerical", "addon.qtype_ordering.moved": "qtype_ordering", + "addon.qtype_shortanswer.pleaseenterananswer": "qtype_shortanswer", + "addon.qtype_truefalse.pleaseselectananswer": "qtype_truefalse", "addon.report_insights.actionsaved": "report_insights", "addon.report_insights.fixedack": "analytics", "addon.report_insights.incorrectlyflagged": "analytics", diff --git a/src/addons/mod/book/pages/contents/contents.html b/src/addons/mod/book/pages/contents/contents.html index 83191f3c514..a03124df1d2 100644 --- a/src/addons/mod/book/pages/contents/contents.html +++ b/src/addons/mod/book/pages/contents/contents.html @@ -10,7 +10,7 @@

- diff --git a/src/addons/mod/book/tests/behat/snapshots/test-basic-usage-of-book-activity-in-app-open-chapters-from-table-of-contents_11.png b/src/addons/mod/book/tests/behat/snapshots/test-basic-usage-of-book-activity-in-app-open-chapters-from-table-of-contents_11.png index 41667409394..63dc621e5d9 100644 Binary files a/src/addons/mod/book/tests/behat/snapshots/test-basic-usage-of-book-activity-in-app-open-chapters-from-table-of-contents_11.png and b/src/addons/mod/book/tests/behat/snapshots/test-basic-usage-of-book-activity-in-app-open-chapters-from-table-of-contents_11.png differ diff --git a/src/addons/mod/imscp/pages/view/view.html b/src/addons/mod/imscp/pages/view/view.html index 611732ec94d..6e6eb66eede 100644 --- a/src/addons/mod/imscp/pages/view/view.html +++ b/src/addons/mod/imscp/pages/view/view.html @@ -11,7 +11,7 @@

- diff --git a/src/addons/mod/lesson/pages/player/player.html b/src/addons/mod/lesson/pages/player/player.html index f56047a6c41..0e2166e3583 100644 --- a/src/addons/mod/lesson/pages/player/player.html +++ b/src/addons/mod/lesson/pages/player/player.html @@ -11,7 +11,7 @@

- diff --git a/src/addons/mod/quiz/accessrules/password/services/handlers/password.ts b/src/addons/mod/quiz/accessrules/password/services/handlers/password.ts index 7e0fec67f2e..5ff4cc59a7e 100644 --- a/src/addons/mod/quiz/accessrules/password/services/handlers/password.ts +++ b/src/addons/mod/quiz/accessrules/password/services/handlers/password.ts @@ -32,14 +32,7 @@ export class AddonModQuizAccessPasswordHandlerService implements AddonModQuizAcc ruleName = 'quizaccess_password'; /** - * Add preflight data that doesn't require user interaction. The data should be added to the preflightData param. - * - * @param quiz The quiz the rule belongs to. - * @param preflightData Object where to add the preflight data. - * @param attempt The attempt started/continued. If not supplied, user is starting a new attempt. - * @param prefetch Whether the user is prefetching the quiz. - * @param siteId Site ID. If not defined, current site. - * @returns Promise resolved when done if async, void if it's synchronous. + * @inheritdoc */ async getFixedPreflightData( quiz: AddonModQuizQuizWSData, @@ -76,33 +69,21 @@ export class AddonModQuizAccessPasswordHandlerService implements AddonModQuizAcc } /** - * Return the Component to use to display the access rule preflight. - * Implement this if your access rule requires a preflight check with user interaction. - * It's recommended to return the class of the component, but you can also return an instance of the component. - * - * @returns The component (or promise resolved with component) to use, undefined if not found. + * @inheritdoc */ getPreflightComponent(): Type | Promise> { return AddonModQuizAccessPasswordComponent; } /** - * Whether or not the handler is enabled on a site level. - * - * @returns True or promise resolved with true if enabled. + * @inheritdoc */ async isEnabled(): Promise { return true; } /** - * Whether the rule requires a preflight check when prefetch/start/continue an attempt. - * - * @param quiz The quiz the rule belongs to. - * @param attempt The attempt started/continued. If not supplied, user is starting a new attempt. - * @param prefetch Whether the user is prefetching the quiz. - * @param siteId Site ID. If not defined, current site. - * @returns Whether the rule requires a preflight check. + * @inheritdoc */ async isPreflightCheckRequired( quiz: AddonModQuizQuizWSData, @@ -117,14 +98,7 @@ export class AddonModQuizAccessPasswordHandlerService implements AddonModQuizAcc } /** - * Function called when the preflight check has passed. This is a chance to record that fact in some way. - * - * @param quiz The quiz the rule belongs to. - * @param attempt The attempt started/continued. - * @param preflightData Preflight data gathered. - * @param prefetch Whether the user is prefetching the quiz. - * @param siteId Site ID. If not defined, current site. - * @returns Promise resolved when done if async, void if it's synchronous. + * @inheritdoc */ async notifyPreflightCheckPassed( quiz: AddonModQuizQuizWSData, @@ -135,21 +109,14 @@ export class AddonModQuizAccessPasswordHandlerService implements AddonModQuizAcc ): Promise { // The password is right, store it to use it automatically in following executions. if (preflightData.quizpassword !== undefined) { - return this.storePassword(quiz.id, preflightData.quizpassword, siteId); + await this.storePassword(quiz.id, preflightData.quizpassword, siteId); } } /** - * Function called when the preflight check fails. This is a chance to record that fact in some way. - * - * @param quiz The quiz the rule belongs to. - * @param attempt The attempt started/continued. - * @param preflightData Preflight data gathered. - * @param prefetch Whether the user is prefetching the quiz. - * @param siteId Site ID. If not defined, current site. - * @returns Promise resolved when done if async, void if it's synchronous. + * @inheritdoc */ - notifyPreflightCheckFailed?( + async notifyPreflightCheckFailed?( quiz: AddonModQuizQuizWSData, attempt: AddonModQuizAttemptWSData | undefined, preflightData: Record, @@ -157,7 +124,7 @@ export class AddonModQuizAccessPasswordHandlerService implements AddonModQuizAcc siteId?: string, ): Promise { // The password is wrong, remove it from DB if it's there. - return this.removePassword(quiz.id, siteId); + await this.removePassword(quiz.id, siteId); } /** @@ -165,7 +132,6 @@ export class AddonModQuizAccessPasswordHandlerService implements AddonModQuizAcc * * @param quizId Quiz ID. * @param siteId Site ID. If not defined, current site. - * @returns Promise resolved when done. */ protected async removePassword(quizId: number, siteId?: string): Promise { const site = await CoreSites.getSite(siteId); @@ -179,7 +145,6 @@ export class AddonModQuizAccessPasswordHandlerService implements AddonModQuizAcc * @param quizId Quiz ID. * @param password Password. * @param siteId Site ID. If not defined, current site. - * @returns Promise resolved when done. */ protected async storePassword(quizId: number, password: string, siteId?: string): Promise { const site = await CoreSites.getSite(siteId); diff --git a/src/addons/mod/quiz/components/index/index.ts b/src/addons/mod/quiz/components/index/index.ts index 30515e84b40..112f1af1b07 100644 --- a/src/addons/mod/quiz/components/index/index.ts +++ b/src/addons/mod/quiz/components/index/index.ts @@ -130,8 +130,6 @@ export class AddonModQuizIndexComponent extends CoreCourseModuleMainActivityComp /** * Attempt the quiz. - * - * @returns Promise resolved when done. */ async attemptQuiz(): Promise { if (this.showStatusSpinner || !this.quiz) { @@ -141,7 +139,9 @@ export class AddonModQuizIndexComponent extends CoreCourseModuleMainActivityComp if (!AddonModQuiz.isQuizOffline(this.quiz)) { // Quiz isn't offline, just open it. - return this.openQuiz(); + this.openQuiz(); + + return; } // Quiz supports offline, check if it needs to be downloaded. @@ -150,7 +150,9 @@ export class AddonModQuizIndexComponent extends CoreCourseModuleMainActivityComp if (isDownloaded) { // Already downloaded, open it. - return this.openQuiz(); + this.openQuiz(); + + return; } // Prefetch the quiz. @@ -242,7 +244,6 @@ export class AddonModQuizIndexComponent extends CoreCourseModuleMainActivityComp * Get the user attempts in the quiz and the result info. * * @param quiz Quiz instance. - * @returns Promise resolved when done. */ protected async getAttempts( quiz: AddonModQuizQuizData, @@ -326,7 +327,6 @@ export class AddonModQuizIndexComponent extends CoreCourseModuleMainActivityComp * Get result info to show. * * @param quiz Quiz. - * @returns Promise resolved when done. */ protected async getResultInfo(quiz: AddonModQuizQuizData): Promise { if (!this.attempts.length || !quiz.showAttemptsGrades || !this.bestGrade?.hasgrade || @@ -382,8 +382,6 @@ export class AddonModQuizIndexComponent extends CoreCourseModuleMainActivityComp /** * Go to review an attempt that has just been finished. - * - * @returns Promise resolved when done. */ protected async goToAutoReview(attempts: AddonModQuizAttemptWSData[]): Promise { if (!this.autoReview) { @@ -505,10 +503,10 @@ export class AddonModQuizIndexComponent extends CoreCourseModuleMainActivityComp /** * Open a quiz to attempt it. */ - protected openQuiz(): void { + protected async openQuiz(): Promise { this.hasPlayed = true; - CoreNavigator.navigateToSitePath( + await CoreNavigator.navigateToSitePath( `${ADDON_MOD_QUIZ_PAGE_NAME}/${this.courseId}/${this.module.id}/player`, { params: { @@ -554,7 +552,7 @@ export class AddonModQuizIndexComponent extends CoreCourseModuleMainActivityComp * @param quiz Quiz data. * @param accessInfo Quiz access information. * @param attempts The attempts to treat. - * @returns Promise resolved when done. + * @returns Formatted attempts. */ protected async treatAttempts( quiz: AddonModQuizQuizData, @@ -630,8 +628,6 @@ export class AddonModQuizIndexComponent extends CoreCourseModuleMainActivityComp /** * Get quiz grade data. - * - * @returns Promise resolved when done. */ protected async getQuizGrade(): Promise { try { @@ -656,8 +652,6 @@ export class AddonModQuizIndexComponent extends CoreCourseModuleMainActivityComp /** * Go to page to review the attempt. - * - * @returns Promise resolved when done. */ async reviewAttempt(attemptId: number): Promise { await CoreNavigator.navigateToSitePath( diff --git a/src/addons/mod/quiz/constants.ts b/src/addons/mod/quiz/constants.ts index 67bd89826cc..8dc0d8775c5 100644 --- a/src/addons/mod/quiz/constants.ts +++ b/src/addons/mod/quiz/constants.ts @@ -54,3 +54,11 @@ export const enum AddonModQuizDisplayOptionsAttemptStates { LATER_WHILE_OPEN = 0x00100, AFTER_CLOSE = 0x00010, } + +/** + * Possible navigation methods for a quiz. + */ +export const enum AddonModQuizNavMethods { + FREE = 'free', + SEQ = 'sequential', +} diff --git a/src/addons/mod/quiz/pages/player/player.html b/src/addons/mod/quiz/pages/player/player.html index 899bd0cfbae..60572189665 100644 --- a/src/addons/mod/quiz/pages/player/player.html +++ b/src/addons/mod/quiz/pages/player/player.html @@ -15,9 +15,9 @@

(click)="showConnectionError($event)" [ariaLabel]="'addon.mod_quiz.connectionerror' | translate" aria-haspopup="dialog">