diff --git a/mod/lesson/view.php b/mod/lesson/view.php index 8e72a5c7ed9..759ca65c5c7 100644 --- a/mod/lesson/view.php +++ b/mod/lesson/view.php @@ -1155,8 +1155,10 @@ $a->notsentcount = 0; foreach ($studentessays as $studentid => $pages) { // students $attempts = count_records('lesson_grades', 'userid', $studentid, 'lessonid', $lesson->id); - $count = 0; + foreach ($pages as $tries) { // pages + $count = 0; + // go through each essay per page foreach($tries as $try) { // actual attempts if ($attempts == $count) { @@ -1626,10 +1628,11 @@ // number of attempts on the lesson $attempts = count_records('lesson_grades', 'userid', $id, 'lessonid', $lesson->id); - $count = 0; // go through each essay foreach ($studentessays[$id] as $page => $tries) { + $count = 0; + // go through each essay per page foreach($tries as $try) { if ($count == $attempts) {