From: tjhunt Date: Wed, 15 Nov 2006 17:32:49 +0000 (+0000) Subject: MDL-7428 - Quiz regrade removes student answers from essay questions that have been... X-Git-Url: http://git.mjollnir.org/gw?a=commitdiff_plain;h=84bf852c1b4aa50fac2ee13437f933280167e9bf;p=moodle.git MDL-7428 - Quiz regrade removes student answers from essay questions that have been graded. Merged from MOODLE_16_STABLE. --- diff --git a/lib/questionlib.php b/lib/questionlib.php index 8b2e5961ce..c5c523be23 100644 --- a/lib/questionlib.php +++ b/lib/questionlib.php @@ -1207,6 +1207,12 @@ function question_process_comment($question, &$state, &$attempt, $comment, $grad // to set the $state->changed flag. if (abs($state->last_graded->grade - $grade) > 0.002 || $state->last_graded->event != QUESTION_EVENTMANUALGRADE) { + + // We want to update existing state (rather than creating new one) if it + // was itself created by a manual grading event. + $state->update = ($state->event == QUESTION_EVENTMANUALGRADE) ? 1 : 0; + + // Update the other parts of the state object. $state->raw_grade = $grade; $state->grade = $grade; $state->penalty = 0; @@ -1214,10 +1220,6 @@ function question_process_comment($question, &$state, &$attempt, $comment, $grad $state->seq_number++; $state->event = QUESTION_EVENTMANUALGRADE; - // We want to update existing state (rather than creating new one) if it - // was itself created by a manual grading event. - $state->update = ($state->event == QUESTION_EVENTMANUALGRADE) ? 1 : 0; - // Update the last graded state (don't simplify!) unset($state->last_graded); $state->last_graded = clone($state);