Skip to content

Commit

Permalink
Merge pull request #1060 from dpalou/MOBILE-2103
Browse files Browse the repository at this point in the history
MOBILE-2103 lesson: Show attempt number when starting
  • Loading branch information
jleyva authored May 26, 2017
2 parents 791ca14 + ff4404e commit ae9ead2
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 1 deletion.
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

0 comments on commit ae9ead2

Please sign in to comment.