Skip to content

Commit 5c1606e

Browse files
committed
MOBILE-4350 quiz: Disable sequential navigation items
1 parent c41ac5a commit 5c1606e

File tree

5 files changed

+60
-56
lines changed

5 files changed

+60
-56
lines changed

src/addons/mod/quiz/components/navigation-modal/navigation-modal.html

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,8 @@ <h1>{{ 'addon.mod_quiz.quiznavigation' | translate }}</h1>
1515
<ion-list>
1616
<ion-item button class="ion-text-wrap {{question.stateClass}}" *ngFor="let question of navigation"
1717
[attr.aria-current]="!summaryShown && currentPage === question.page ? 'page' : 'false'"
18-
(click)="loadPage(question.page, question.slot)" [detail]="false">
18+
[disabled]="!isReview && isSequential && currentPage !== question.page" (click)="loadPage(question.page, question.slot)"
19+
[detail]="false">
1920

2021
<ion-label class="ion-text-wrap">
2122
<span *ngIf="question.type !== 'description' && question.questionnumber">

src/addons/mod/quiz/components/navigation-modal/navigation-modal.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ export class AddonModQuizNavigationModalComponent {
3030
@Input() summaryShown?: boolean; // Whether summary is currently being shown.
3131
@Input() currentPage?: number; // Current page.
3232
@Input() isReview?: boolean; // Whether the user is reviewing the attempt.
33+
@Input() isSequential?: boolean; // Whether quiz navigation is sequential.
3334

3435
/**
3536
* Close modal.

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

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -559,8 +559,6 @@ export class AddonModQuizPlayerPage implements OnInit, OnDestroy, CanLeave {
559559
return;
560560
}
561561

562-
// @todo MOBILE-4350: This is called before getting the attempt data in sequential quizzes as a workaround for a bug
563-
// in the LMS. Once the bug has been fixed, this should be reverted.
564562
if (this.isSequential) {
565563
await this.logViewPage(page);
566564
}
@@ -594,7 +592,6 @@ export class AddonModQuizPlayerPage implements OnInit, OnDestroy, CanLeave {
594592

595593
// Mark the page as viewed.
596594
if (!this.isSequential) {
597-
// @todo MOBILE-4350: Undo workaround.
598595
await this.logViewPage(page);
599596
}
600597

@@ -734,6 +731,7 @@ export class AddonModQuizPlayerPage implements OnInit, OnDestroy, CanLeave {
734731
summaryShown: this.showSummary,
735732
currentPage: this.attempt?.currentpage,
736733
isReview: false,
734+
isSequential: this.isSequential,
737735
},
738736
});
739737

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -345,6 +345,7 @@ export class AddonModQuizReviewPage implements OnInit {
345345
summaryShown: false,
346346
currentPage: this.attempt?.currentpage,
347347
isReview: true,
348+
isSequential: this.quiz && AddonModQuiz.isNavigationSequential(this.quiz),
348349
},
349350
});
350351

src/addons/mod/quiz/tests/behat/quiz_navigation.feature

Lines changed: 55 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -83,55 +83,58 @@ Feature: Navigate through a quiz in the app
8383
And I should find "Text of the first question" in the app
8484
And I should find "Text of the second question" in the app
8585

86-
# @todo MOBILE-4350 uncomment and update this test.
87-
# Scenario: Sequential navigation
88-
# Given I entered the quiz activity "Quiz 2" on course "Course 1" as "student1" in the app
89-
# And I press "Attempt quiz now" in the app
90-
# Then I should find "Text of the first question" in the app
91-
# But I should not find "Text of the second question" in the app
92-
# And I should not find "Text of the third question" in the app
93-
94-
# When I press "Open navigation popover" in the app
95-
# Then I should find "Question 1" in the app
96-
# But I should not find "Question 2" in the app
97-
# And I should not find "Question 3" in the app
98-
99-
# When I press "Close" in the app
100-
# And I press "Next" in the app
101-
# Then I should find "Text of the second question" in the app
102-
# But I should not find "Text of the first question" in the app
103-
# And I should not find "Text of the third question" in the app
104-
# And I should not find "Previous" in the app
105-
106-
# When I press "Open navigation popover" in the app
107-
# Then I should find "Question 2" in the app
108-
# But I should not find "Question 1" in the app
109-
# And I should not find "Question 3" in the app
110-
111-
# When I press "Close" in the app
112-
# And I press "Next" in the app
113-
# Then I should find "Text of the third question" in the app
114-
# But I should not find "Text of the first question" in the app
115-
# And I should not find "Text of the second question" in the app
116-
# And I should not find "Previous" in the app
117-
118-
# When I press "Open navigation popover" in the app
119-
# Then I should find "Question 3" in the app
120-
# But I should not find "Question 1" in the app
121-
# And I should not find "Question 2" in the app
122-
123-
# When I press "Close" in the app
124-
# And I press "Submit" in the app
125-
# Then I should find "Summary of attempt" in the app
126-
# # @todo MOBILE-4350: Uncomment these.
127-
# # And I should find "Not yet answered" within "1" "ion-item" in the app
128-
# # And I should find "Not yet answered" within "2" "ion-item" in the app
129-
# # And I should find "Not yet answered" within "3" "ion-item" in the app
130-
131-
# When I press "Submit all and finish" in the app
132-
# And I press "Submit" near "Once you submit" in the app
133-
# Then I should find "Review" in the app
134-
# # @todo MOBILE-4350: Uncomment these.
135-
# # And I should find "Text of the first question" in the app
136-
# # And I should find "Text of the second question" in the app
137-
# # And I should find "Text of the third question" in the app
86+
Scenario: Sequential navigation
87+
Given I entered the quiz activity "Quiz 2" on course "Course 1" as "student1" in the app
88+
And I press "Attempt quiz now" in the app
89+
Then I should find "Text of the first question" in the app
90+
But I should not find "Text of the second question" in the app
91+
And I should not find "Text of the third question" in the app
92+
93+
When I press "Open navigation popover" in the app
94+
Then I should find "Question 1" in the app
95+
And I should find "Question 2" in the app
96+
And I should find "Question 3" in the app
97+
But I should not be able to press "Question 2" in the app
98+
And I should not be able to press "Question 3" in the app
99+
100+
When I press "Close" in the app
101+
And I press "Next" in the app
102+
Then I should find "Text of the second question" in the app
103+
But I should not find "Text of the first question" in the app
104+
And I should not find "Text of the third question" in the app
105+
And I should not find "Previous" in the app
106+
107+
When I press "Open navigation popover" in the app
108+
Then I should find "Question 1" in the app
109+
And I should find "Question 2" in the app
110+
And I should find "Question 3" in the app
111+
But I should not be able to press "Question 1" in the app
112+
And I should not be able to press "Question 3" in the app
113+
114+
When I press "Close" in the app
115+
And I press "Next" in the app
116+
Then I should find "Text of the third question" in the app
117+
But I should not find "Text of the first question" in the app
118+
And I should not find "Text of the second question" in the app
119+
And I should not find "Previous" in the app
120+
121+
When I press "Open navigation popover" in the app
122+
Then I should find "Question 1" in the app
123+
And I should find "Question 2" in the app
124+
And I should find "Question 3" in the app
125+
But I should not be able to press "Question 1" in the app
126+
And I should not be able to press "Question 2" in the app
127+
128+
When I press "Close" in the app
129+
And I press "Submit" in the app
130+
Then I should find "Summary of attempt" in the app
131+
And I should find "Not yet answered" within "1" "ion-item" in the app
132+
And I should find "Not yet answered" within "2" "ion-item" in the app
133+
And I should find "Not yet answered" within "3" "ion-item" in the app
134+
135+
When I press "Submit all and finish" in the app
136+
And I press "Submit" near "Once you submit" in the app
137+
Then I should find "Review" in the app
138+
And I should find "Text of the first question" in the app
139+
And I should find "Text of the second question" in the app
140+
And I should find "Text of the third question" in the app

0 commit comments

Comments
 (0)