MOBILE-3269 quiz: Fix cannot read 'activerulenames' of undefined
parent
02173db1b1
commit
c6393b4a97
|
@ -111,9 +111,10 @@ export class AddonModQuizHelperProvider {
|
||||||
*/
|
*/
|
||||||
getPreflightData(quiz: any, accessInfo: any, attempt: any, prefetch?: boolean, title?: string, siteId?: string): Promise<any> {
|
getPreflightData(quiz: any, accessInfo: any, attempt: any, prefetch?: boolean, title?: string, siteId?: string): Promise<any> {
|
||||||
const notSupported: string[] = [];
|
const notSupported: string[] = [];
|
||||||
|
const rules = accessInfo && accessInfo.activerulenames;
|
||||||
|
|
||||||
// Check if there is any unsupported rule.
|
// Check if there is any unsupported rule.
|
||||||
accessInfo.activerulenames.forEach((rule) => {
|
rules.forEach((rule) => {
|
||||||
if (!this.accessRuleDelegate.isAccessRuleSupported(rule)) {
|
if (!this.accessRuleDelegate.isAccessRuleSupported(rule)) {
|
||||||
notSupported.push(rule);
|
notSupported.push(rule);
|
||||||
}
|
}
|
||||||
|
@ -131,7 +132,7 @@ export class AddonModQuizHelperProvider {
|
||||||
attempt: attempt,
|
attempt: attempt,
|
||||||
prefetch: !!prefetch,
|
prefetch: !!prefetch,
|
||||||
siteId: siteId,
|
siteId: siteId,
|
||||||
rules: accessInfo.activerulenames
|
rules: rules
|
||||||
});
|
});
|
||||||
|
|
||||||
modal.present();
|
modal.present();
|
||||||
|
@ -296,7 +297,7 @@ export class AddonModQuizHelperProvider {
|
||||||
validatePreflightData(quiz: any, accessInfo: any, preflightData: any, attempt: any, offline?: boolean, prefetch?: boolean,
|
validatePreflightData(quiz: any, accessInfo: any, preflightData: any, attempt: any, offline?: boolean, prefetch?: boolean,
|
||||||
siteId?: string): Promise<any> {
|
siteId?: string): Promise<any> {
|
||||||
|
|
||||||
const rules = accessInfo.activerulenames;
|
const rules = accessInfo && accessInfo.activerulenames;
|
||||||
let promise;
|
let promise;
|
||||||
|
|
||||||
if (attempt) {
|
if (attempt) {
|
||||||
|
|
|
@ -160,7 +160,7 @@ export class AddonModQuizPrefetchHandler extends CoreCourseActivityPrefetchHandl
|
||||||
quiz, accessInfo, preflightData, attempt, false, true, title, siteId);
|
quiz, accessInfo, preflightData, attempt, false, true, title, siteId);
|
||||||
} else {
|
} else {
|
||||||
// Get some fixed preflight data from access rules (data that doesn't require user interaction).
|
// Get some fixed preflight data from access rules (data that doesn't require user interaction).
|
||||||
const rules = accessInfo.activerulenames;
|
const rules = accessInfo && accessInfo.activerulenames;
|
||||||
|
|
||||||
promise = this.accessRuleDelegate.getFixedPreflightData(rules, quiz, preflightData, attempt, true, siteId).then(() => {
|
promise = this.accessRuleDelegate.getFixedPreflightData(rules, quiz, preflightData, attempt, true, siteId).then(() => {
|
||||||
if (!attempt) {
|
if (!attempt) {
|
||||||
|
|
Loading…
Reference in New Issue