@@ -32,14 +32,7 @@ export class AddonModQuizAccessPasswordHandlerService implements AddonModQuizAcc
3232 ruleName = 'quizaccess_password' ;
3333
3434 /**
35- * Add preflight data that doesn't require user interaction. The data should be added to the preflightData param.
36- *
37- * @param quiz The quiz the rule belongs to.
38- * @param preflightData Object where to add the preflight data.
39- * @param attempt The attempt started/continued. If not supplied, user is starting a new attempt.
40- * @param prefetch Whether the user is prefetching the quiz.
41- * @param siteId Site ID. If not defined, current site.
42- * @returns Promise resolved when done if async, void if it's synchronous.
35+ * @inheritdoc
4336 */
4437 async getFixedPreflightData (
4538 quiz : AddonModQuizQuizWSData ,
@@ -76,33 +69,21 @@ export class AddonModQuizAccessPasswordHandlerService implements AddonModQuizAcc
7669 }
7770
7871 /**
79- * Return the Component to use to display the access rule preflight.
80- * Implement this if your access rule requires a preflight check with user interaction.
81- * It's recommended to return the class of the component, but you can also return an instance of the component.
82- *
83- * @returns The component (or promise resolved with component) to use, undefined if not found.
72+ * @inheritdoc
8473 */
8574 getPreflightComponent ( ) : Type < unknown > | Promise < Type < unknown > > {
8675 return AddonModQuizAccessPasswordComponent ;
8776 }
8877
8978 /**
90- * Whether or not the handler is enabled on a site level.
91- *
92- * @returns True or promise resolved with true if enabled.
79+ * @inheritdoc
9380 */
9481 async isEnabled ( ) : Promise < boolean > {
9582 return true ;
9683 }
9784
9885 /**
99- * Whether the rule requires a preflight check when prefetch/start/continue an attempt.
100- *
101- * @param quiz The quiz the rule belongs to.
102- * @param attempt The attempt started/continued. If not supplied, user is starting a new attempt.
103- * @param prefetch Whether the user is prefetching the quiz.
104- * @param siteId Site ID. If not defined, current site.
105- * @returns Whether the rule requires a preflight check.
86+ * @inheritdoc
10687 */
10788 async isPreflightCheckRequired (
10889 quiz : AddonModQuizQuizWSData ,
@@ -117,14 +98,7 @@ export class AddonModQuizAccessPasswordHandlerService implements AddonModQuizAcc
11798 }
11899
119100 /**
120- * Function called when the preflight check has passed. This is a chance to record that fact in some way.
121- *
122- * @param quiz The quiz the rule belongs to.
123- * @param attempt The attempt started/continued.
124- * @param preflightData Preflight data gathered.
125- * @param prefetch Whether the user is prefetching the quiz.
126- * @param siteId Site ID. If not defined, current site.
127- * @returns Promise resolved when done if async, void if it's synchronous.
101+ * @inheritdoc
128102 */
129103 async notifyPreflightCheckPassed (
130104 quiz : AddonModQuizQuizWSData ,
@@ -135,37 +109,29 @@ export class AddonModQuizAccessPasswordHandlerService implements AddonModQuizAcc
135109 ) : Promise < void > {
136110 // The password is right, store it to use it automatically in following executions.
137111 if ( preflightData . quizpassword !== undefined ) {
138- return this . storePassword ( quiz . id , preflightData . quizpassword , siteId ) ;
112+ await this . storePassword ( quiz . id , preflightData . quizpassword , siteId ) ;
139113 }
140114 }
141115
142116 /**
143- * Function called when the preflight check fails. This is a chance to record that fact in some way.
144- *
145- * @param quiz The quiz the rule belongs to.
146- * @param attempt The attempt started/continued.
147- * @param preflightData Preflight data gathered.
148- * @param prefetch Whether the user is prefetching the quiz.
149- * @param siteId Site ID. If not defined, current site.
150- * @returns Promise resolved when done if async, void if it's synchronous.
117+ * @inheritdoc
151118 */
152- notifyPreflightCheckFailed ?(
119+ async notifyPreflightCheckFailed ?(
153120 quiz : AddonModQuizQuizWSData ,
154121 attempt : AddonModQuizAttemptWSData | undefined ,
155122 preflightData : Record < string , string > ,
156123 prefetch ?: boolean ,
157124 siteId ?: string ,
158125 ) : Promise < void > {
159126 // The password is wrong, remove it from DB if it's there.
160- return this . removePassword ( quiz . id , siteId ) ;
127+ await this . removePassword ( quiz . id , siteId ) ;
161128 }
162129
163130 /**
164131 * Remove a password from DB.
165132 *
166133 * @param quizId Quiz ID.
167134 * @param siteId Site ID. If not defined, current site.
168- * @returns Promise resolved when done.
169135 */
170136 protected async removePassword ( quizId : number , siteId ?: string ) : Promise < void > {
171137 const site = await CoreSites . getSite ( siteId ) ;
@@ -179,7 +145,6 @@ export class AddonModQuizAccessPasswordHandlerService implements AddonModQuizAcc
179145 * @param quizId Quiz ID.
180146 * @param password Password.
181147 * @param siteId Site ID. If not defined, current site.
182- * @returns Promise resolved when done.
183148 */
184149 protected async storePassword ( quizId : number , password : string , siteId ?: string ) : Promise < void > {
185150 const site = await CoreSites . getSite ( siteId ) ;
0 commit comments