Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions src/addon/mod/quiz/providers/helper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -111,9 +111,10 @@ export class AddonModQuizHelperProvider {
*/
getPreflightData(quiz: any, accessInfo: any, attempt: any, prefetch?: boolean, title?: string, siteId?: string): Promise<any> {
const notSupported: string[] = [];
const rules = accessInfo && accessInfo.activerulenames;

// Check if there is any unsupported rule.
accessInfo.activerulenames.forEach((rule) => {
rules.forEach((rule) => {
if (!this.accessRuleDelegate.isAccessRuleSupported(rule)) {
notSupported.push(rule);
}
Expand All @@ -131,7 +132,7 @@ export class AddonModQuizHelperProvider {
attempt: attempt,
prefetch: !!prefetch,
siteId: siteId,
rules: accessInfo.activerulenames
rules: rules
});

modal.present();
Expand Down Expand Up @@ -296,7 +297,7 @@ export class AddonModQuizHelperProvider {
validatePreflightData(quiz: any, accessInfo: any, preflightData: any, attempt: any, offline?: boolean, prefetch?: boolean,
siteId?: string): Promise<any> {

const rules = accessInfo.activerulenames;
const rules = accessInfo && accessInfo.activerulenames;
let promise;

if (attempt) {
Expand Down
2 changes: 1 addition & 1 deletion src/addon/mod/quiz/providers/prefetch-handler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ export class AddonModQuizPrefetchHandler extends CoreCourseActivityPrefetchHandl
quiz, accessInfo, preflightData, attempt, false, true, title, siteId);
} else {
// 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(() => {
if (!attempt) {
Expand Down