Skip to content

Commit e08c9a3

Browse files
committed
MOBILE-1600 mod_quiz: Check when display the review button
1 parent 45811b1 commit e08c9a3

File tree

4 files changed

+10
-4
lines changed

4 files changed

+10
-4
lines changed

www/addons/mod/quiz/controllers/attempt.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,11 @@ angular.module('mm.addons.mod_quiz')
7171

7272
promises.push($mmaModQuiz.getQuizAccessInformation(quiz.id).then(function(aI) {
7373
accessInfo = aI;
74+
if (accessInfo.canreviewmyattempts) {
75+
return $mmaModQuiz.getAttemptReview(attemptId, -1).catch(function() {
76+
accessInfo.canreviewmyattempts = false;
77+
});
78+
}
7479
}));
7580

7681
return $q.all(promises).then(function() {
@@ -102,6 +107,7 @@ angular.module('mm.addons.mod_quiz')
102107
promises.push($mmaModQuiz.invalidateUserAttemptsForUser(quizId));
103108
promises.push($mmaModQuiz.invalidateQuizAccessInformation(quizId));
104109
promises.push($mmaModQuiz.invalidateCombinedReviewOptionsForUser(quizId));
110+
promises.push($mmaModQuiz.invalidateAttemptReview(attemptId));
105111
if (typeof attempt.feedback != 'undefined') {
106112
promises.push($mmaModQuiz.invalidateFeedback(quizId));
107113
}

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@
3737
"marks": "Marks",
3838
"mustbesubmittedby": "This attempt must be submitted by {{$a}}.",
3939
"noquestions": "No questions have been added yet",
40+
"noreviewattempt": "You are not allowed to review this attempt.",
4041
"notyetgraded": "Not yet graded",
4142
"opentoc": "Open navigation popover.",
4243
"outof": "{{$a.grade}} out of {{$a.maxgrade}}",

www/addons/mod/quiz/templates/attempt.html

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,9 @@
2828
<div class="item" ng-if="quiz.showReviewColumn && attempt.finished">
2929
<button class="button button-block" ui-sref="site.mod_quiz-review({courseid: courseId, quizid: quiz.id, attemptid: attempt.id})">{{ 'mma.mod_quiz.review' | translate }}</button>
3030
</div>
31+
<div class="item item-text-wrap mma-mod-quiz-warning" ng-if="!quiz.showReviewColumn">
32+
<p class="mma-mod-quiz-warning">{{ 'mma.mod_quiz.noreviewattempt' | translate }}</p>
33+
</div>
3134
</div>
3235
</mm-loading>
3336
</ion-content>

www/addons/mod/quiz/templates/index.html

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,6 @@ <h2>{{ 'mma.mod_quiz.summaryofattempts' | translate }}</h2>
3333
<p class="col col-50"><b>{{ 'mma.mod_quiz.attemptstate' | translate }}</b></p>
3434
<p class="col text-center" ng-if="isTablet && quiz.showMarkColumn"><b>{{ 'mma.mod_quiz.marks' | translate }} / {{ quiz.sumGradesFormatted }}</b></p>
3535
<p class="col text-center" ng-if="quiz.showGradeColumn"><b>{{ 'mma.mod_quiz.grade' | translate }} / {{ quiz.gradeFormatted }}</b></p>
36-
<p class="col text-center" ng-if="isTablet && quiz.showReviewColumn"><b>{{ 'mma.mod_quiz.review' | translate }}</b></p>
3736
<p class="col col-10"></p>
3837
</div>
3938
<div class="item item-text-wrap row" ng-repeat="attempt in attempts" ng-class='{"mma-mod-quiz-highlighted": attempt.highlightGrade}'>
@@ -44,9 +43,6 @@ <h2>{{ 'mma.mod_quiz.summaryofattempts' | translate }}</h2>
4443
</div>
4544
<p class="col text-center" ng-if="isTablet && quiz.showMarkColumn">{{ attempt.readableMark }}</p>
4645
<p class="col text-center" ng-if="quiz.showGradeColumn">{{ attempt.readableGrade }}</p>
47-
<p class="col text-center" ng-if="isTablet && quiz.showReviewColumn">
48-
<button class="button button-block" ng-if="attempt.finished" ui-sref="site.mod_quiz-review({courseid: courseId, quizid: quiz.id, attemptid: attempt.id})">{{ 'mma.mod_quiz.review' | translate }}</button>
49-
</p>
5046
<p class="col col-10 text-center">
5147
<a class="button button-block button-icon ion-ios-arrow-forward" ui-sref="site.mod_quiz-attempt({courseid: courseId, quizid: quiz.id, attemptid: attempt.id})" aria-label="{{ 'mm.core.seemoredetail' | translate }}"></a>
5248
</p>

0 commit comments

Comments
 (0)