From: tjhunt Date: Wed, 4 Oct 2006 10:21:23 +0000 (+0000) Subject: MDL-6814 - Can't change "maximum grade" value on a quiz. Now you can. X-Git-Url: http://git.mjollnir.org/gw?a=commitdiff_plain;h=b22fc9018282e5c0a6331a814fd1f2e5f7c75035;p=moodle.git MDL-6814 - Can't change "maximum grade" value on a quiz. Now you can. --- diff --git a/mod/quiz/locallib.php b/mod/quiz/locallib.php index b2d8a27c10..cd4451b90b 100644 --- a/mod/quiz/locallib.php +++ b/mod/quiz/locallib.php @@ -346,7 +346,7 @@ function quiz_set_grade($newgrade, &$quiz) { // Nothing to do. return true; } - + // Use a transaction, so that on those databases that support it, this is safer. begin_sql(); @@ -362,14 +362,18 @@ function quiz_set_grade($newgrade, &$quiz) { // Update the quiz_grades table. $timemodified = time(); - $success = $success && set_field('quiz_grades', 'grade', - '$factor * grade, timemodified = $timemodified', - 'quiz', $quiz->id); - + $success = $success && execute_sql(" + UPDATE {$CFG->prefix}quiz_grades + SET grade = $factor * grade, timemodified = $timemodified + WHERE quiz = $quiz->id + ", false); + // Update the quiz_grades table. - $success = $success && execute_sql('quiz_feedback', 'mingrade', - '$factor * mingrade, maxgrade = $factor * maxgrade', - 'quizid', $quiz->id); + $success = $success && execute_sql(" + UPDATE {$CFG->prefix}quiz_feedback + SET mingrade = $factor * mingrade, maxgrade = $factor * maxgrade + WHERE quizid = $quiz->id + ", false); } if ($success) {