From fca490bca0ddce652b40b9e9e5b1488e7ab83123 Mon Sep 17 00:00:00 2001 From: tjhunt Date: Wed, 19 Sep 2007 10:56:24 +0000 Subject: [PATCH] MDL-6315 - When processing a manul grading action, if both the comment and the score are blank - as might be the case on the 'Grade all' page of the manual grading when the teacher uses it to grade some, but not all of the students - then do not record the question as graded. Merged from MOODLE_18_STABLE. --- lib/questionlib.php | 5 +++-- mod/quiz/report/grading/report.php | 2 +- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/lib/questionlib.php b/lib/questionlib.php index 491554ac53..20d649857f 100644 --- a/lib/questionlib.php +++ b/lib/questionlib.php @@ -1342,6 +1342,7 @@ function question_print_comment_box($question, $state, $attempt, $url) { function question_process_comment($question, &$state, &$attempt, $comment, $grade) { // Update the comment and save it in the database + $comment = trim($comment); $state->manualcomment = $comment; if (!set_field('question_sessions', 'manualcomment', $comment, 'attemptid', $attempt->uniqueid, 'questionid', $question->id)) { error("Cannot save comment"); @@ -1357,11 +1358,11 @@ function question_process_comment($question, &$state, &$attempt, $comment, $grad } // Update the state if either the score has changed, or this is the first - // manual grade event. + // manual grade event and there is actually a grade of comment to process. // We don't need to store the modified state in the database, we just need // to set the $state->changed flag. if (abs($state->last_graded->grade - $grade) > 0.002 || - $state->last_graded->event != QUESTION_EVENTMANUALGRADE) { + ($state->last_graded->event != QUESTION_EVENTMANUALGRADE && ($grade > 0.002 || $comment != ''))) { // We want to update existing state (rather than creating new one) if it // was itself created by a manual grading event. diff --git a/mod/quiz/report/grading/report.php b/mod/quiz/report/grading/report.php index 01bae3a0b0..ea18f345a1 100644 --- a/mod/quiz/report/grading/report.php +++ b/mod/quiz/report/grading/report.php @@ -84,7 +84,7 @@ class quiz_report extends quiz_default_report { quiz_save_best_grade($quiz, $attempt->userid); } } - notify(get_string('changessaved', 'quiz')); + notify(get_string('changessaved', 'quiz'), 'notifysuccess'); } // our 3 different views -- 2.39.5