From ff4404ef023b4a9f4b67027b706a748e4fdbdc78 Mon Sep 17 00:00:00 2001 From: Dani Palou Date: Fri, 26 May 2017 12:18:47 +0200 Subject: [PATCH] MOBILE-2103 lesson: Show attempt number when starting --- www/addons/mod/lesson/controllers/player.js | 11 ++++++++++- www/addons/mod/lesson/lang/en.json | 1 + www/addons/mod/lesson/templates/player.html | 1 + 3 files changed, 12 insertions(+), 1 deletion(-) diff --git a/www/addons/mod/lesson/controllers/player.js b/www/addons/mod/lesson/controllers/player.js index 24932b52fe2..7c2e5f840d5 100644 --- a/www/addons/mod/lesson/controllers/player.js +++ b/www/addons/mod/lesson/controllers/player.js @@ -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); @@ -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. @@ -210,6 +213,12 @@ angular.module('mm.addons.mod_lesson') loadMenu(); } $scope.displayMenu = !!data.displaymenu; + + if (!firstPageLoaded) { + firstPageLoaded = true; + } else { + $scope.showRetake = false; + } }); } diff --git a/www/addons/mod/lesson/lang/en.json b/www/addons/mod/lesson/lang/en.json index a85e9edbe81..92a9bb049b6 100644 --- a/www/addons/mod/lesson/lang/en.json +++ b/www/addons/mod/lesson/lang/en.json @@ -1,5 +1,6 @@ { "answer": "Answer", + "attempt": "Attempt: {{$a}}", "attemptheader": "Attempt", "attemptsremaining": "You have {{$a}} attempt(s) remaining", "averagescore": "Average score", diff --git a/www/addons/mod/lesson/templates/player.html b/www/addons/mod/lesson/templates/player.html index 71688f8561c..be2e0f0a498 100644 --- a/www/addons/mod/lesson/templates/player.html +++ b/www/addons/mod/lesson/templates/player.html @@ -15,6 +15,7 @@ +

{{ 'mma.mod_lesson.attempt' | translate:{$a: retake} }}

{{pageData.ongoingscore}}

{{pageContent}}