Skip to content

Commit

Permalink
MDL-60538 lesson: check if max attempts exceeded, use new lang string
Browse files Browse the repository at this point in the history
  • Loading branch information
Mihail Geshoski committed Oct 25, 2017
1 parent 8494051 commit 994ccb7
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
1 change: 1 addition & 0 deletions mod/lesson/lang/en/lesson.php
Expand Up @@ -223,6 +223,7 @@
$string['eventquestionviewed'] = 'Question viewed';
$string['false'] = 'False';
$string['fileformat'] = 'File format';
$string['finalwrong'] = 'Not quite.';
$string['finish'] = 'Finish';
$string['firstanswershould'] = 'First answer should jump to the "Correct" page';
$string['firstwrong'] = 'You have answered incorrectly. Would you like to attempt the question again? (If you now answer the question correctly, it will not count towards your final score.)';
Expand Down
6 changes: 5 additions & 1 deletion mod/lesson/locallib.php
Expand Up @@ -4100,7 +4100,11 @@ final public function record_attempt($context) {
if ($qattempts == 1) {
$result->feedback = $OUTPUT->box(get_string("firstwrong", "lesson"), 'feedback');
} else {
$result->feedback = $OUTPUT->box(get_string("secondpluswrong", "lesson"), 'feedback');
if (!$result->maxattemptsreached) {
$result->feedback = $OUTPUT->box(get_string("secondpluswrong", "lesson"), 'feedback');
} else {
$result->feedback = $OUTPUT->box(get_string("finalwrong", "lesson"), 'feedback');
}
}
} else {
$result->feedback = '';
Expand Down

0 comments on commit 994ccb7

Please sign in to comment.