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
11 changes: 10 additions & 1 deletion www/addons/mod/lesson/controllers/player.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,8 @@ angular.module('mm.addons.mod_lesson')
scrollView,
originalData,
blockData,
jumps;
jumps,
firstPageLoaded = false;

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

accessInfo = info;
$scope.canManage = info.canmanage;
$scope.retake = accessInfo.attemptscount;
$scope.showRetake = !$scope.currentPage && $scope.retake > 0;

if (info.preventaccessreasons && info.preventaccessreasons.length) {
// If it's a password protected lesson and we have the password, allow playing it.
Expand Down Expand Up @@ -210,6 +213,12 @@ angular.module('mm.addons.mod_lesson')
loadMenu();
}
$scope.displayMenu = !!data.displaymenu;

if (!firstPageLoaded) {
firstPageLoaded = true;
} else {
$scope.showRetake = false;
}
});
}

Expand Down
1 change: 1 addition & 0 deletions www/addons/mod/lesson/lang/en.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{
"answer": "Answer",
"attempt": "Attempt: {{$a}}",
"attemptheader": "Attempt",
"attemptsremaining": "You have {{$a}} attempt(s) remaining",
"averagescore": "Average score",
Expand Down
1 change: 1 addition & 0 deletions www/addons/mod/lesson/templates/player.html
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
<mm-timer ng-if="endTime" end-time="endTime" finished="timeUp()" timer-text="{{ 'mma.mod_lesson.timeremaining' | translate }}"></mm-timer>

<!-- Page content, including questions and buttons. -->
<p ng-if="showRetake && !eolData && !processData" class="item item-text-wrap">{{ 'mma.mod_lesson.attempt' | translate:{$a: retake} }}</p>
<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>
<form ng-if="!eolData && !processData" name="mma-mod_lesson-player-form" class="card">
<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>
Expand Down