Skip to content

Commit

Permalink
[BugFix] Bug #4174 - Lesson Essay Question Can't be Graded when attem…
Browse files Browse the repository at this point in the history
…pt not finished
  • Loading branch information
michaelpenne committed Feb 24, 2006
1 parent c200adc commit f0ebc09
Showing 1 changed file with 18 additions and 1 deletion.
19 changes: 18 additions & 1 deletion mod/lesson/view.php
Original file line number Diff line number Diff line change
Expand Up @@ -1153,10 +1153,17 @@
$a = new stdClass;
$a->notgradedcount = 0;
$a->notsentcount = 0;
foreach ($studentessays as $pages) { // students
foreach ($studentessays as $studentid => $pages) { // students
$attempts = count_records('lesson_grades', 'userid', $studentid, 'lessonid', $lesson->id);
$count = 0;
foreach ($pages as $tries) { // pages
// go through each essay per page
foreach($tries as $try) { // actual attempts
if ($attempts == $count) {
break; // dont count unfinnished attempts
}
$count++;

// make sure they didn't answer it more than the max number of attmepts
if (count($try) > $lesson->maxattempts) {
$essay = $try[$lesson->maxattempts-1];
Expand Down Expand Up @@ -1616,10 +1623,20 @@
foreach ($studentids as $id) {
$studentname = $users[$id]->lastname.", ".$users[$id]->firstname;
$essaylinks = array();

// 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) {
// go through each essay per page
foreach($tries as $try) {
if ($count == $attempts) {
break; // stop displaying essays (attempt not completed)
}
$count++;

// make sure they didn't answer it more than the max number of attmepts
if (count($try) > $lesson->maxattempts) {
$essay = $try[$lesson->maxattempts-1];
Expand Down

0 comments on commit f0ebc09

Please sign in to comment.