Skip to content

Commit ae9ead2

Browse files
authored
Merge pull request #1060 from dpalou/MOBILE-2103
MOBILE-2103 lesson: Show attempt number when starting
2 parents 791ca14 + ff4404e commit ae9ead2

File tree

3 files changed

+12
-1
lines changed

3 files changed

+12
-1
lines changed

www/addons/mod/lesson/controllers/player.js

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,8 @@ angular.module('mm.addons.mod_lesson')
3434
scrollView,
3535
originalData,
3636
blockData,
37-
jumps;
37+
jumps,
38+
firstPageLoaded = false;
3839

3940
// Block the lesson so it cannot be synced.
4041
$mmSyncBlock.blockOperation(mmaModLessonComponent, lessonId);
@@ -73,6 +74,8 @@ angular.module('mm.addons.mod_lesson')
7374

7475
accessInfo = info;
7576
$scope.canManage = info.canmanage;
77+
$scope.retake = accessInfo.attemptscount;
78+
$scope.showRetake = !$scope.currentPage && $scope.retake > 0;
7679

7780
if (info.preventaccessreasons && info.preventaccessreasons.length) {
7881
// If it's a password protected lesson and we have the password, allow playing it.
@@ -210,6 +213,12 @@ angular.module('mm.addons.mod_lesson')
210213
loadMenu();
211214
}
212215
$scope.displayMenu = !!data.displaymenu;
216+
217+
if (!firstPageLoaded) {
218+
firstPageLoaded = true;
219+
} else {
220+
$scope.showRetake = false;
221+
}
213222
});
214223
}
215224

www/addons/mod/lesson/lang/en.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
{
22
"answer": "Answer",
3+
"attempt": "Attempt: {{$a}}",
34
"attemptheader": "Attempt",
45
"attemptsremaining": "You have {{$a}} attempt(s) remaining",
56
"averagescore": "Average score",

www/addons/mod/lesson/templates/player.html

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
<mm-timer ng-if="endTime" end-time="endTime" finished="timeUp()" timer-text="{{ 'mma.mod_lesson.timeremaining' | translate }}"></mm-timer>
1616

1717
<!-- Page content, including questions and buttons. -->
18+
<p ng-if="showRetake && !eolData && !processData" class="item item-text-wrap">{{ 'mma.mod_lesson.attempt' | translate:{$a: retake} }}</p>
1819
<mm-format-text ng-if="pageData.ongoingscore && !eolData && !processData" class="item item-text-wrap mma-mod-lesson-ongoingscore" watch="true">{{pageData.ongoingscore}}</mm-format-text>
1920
<form ng-if="!eolData && !processData" name="mma-mod_lesson-player-form" class="card">
2021
<p class="item item-text-wrap" ng-class="{'item-divider': question}"><mm-format-text watch="true" component="{{component}}" component-id="{{lesson.coursemodule}}">{{pageContent}}</mm-format-text></p>

0 commit comments

Comments
 (0)