From e5549f4f16ac58c01aca8d21ad150067a4067398 Mon Sep 17 00:00:00 2001 From: Mark Nelson Date: Wed, 23 Dec 2015 14:17:25 +0800 Subject: [PATCH] MDL-52275 core: fixed grade-to-pass being overwritten Thanks goes to W.J. Roes for the patch. --- course/modedit.php | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/course/modedit.php b/course/modedit.php index 4b9edaf780e..65880f9bcf1 100644 --- a/course/modedit.php +++ b/course/modedit.php @@ -187,15 +187,14 @@ if (!empty($add)) { if ($items = grade_item::fetch_all(array('itemtype'=>'mod', 'itemmodule'=>$data->modulename, 'iteminstance'=>$data->instance, 'courseid'=>$course->id))) { - // add existing outcomes + // Add existing outcomes. foreach ($items as $item) { - if (!empty($item->gradepass)) { + if (!empty($item->outcomeid)) { + $data->{'outcome_' . $item->outcomeid} = 1; + } else if (!empty($item->gradepass)) { $decimalpoints = $item->get_decimals(); $data->gradepass = format_float($item->gradepass, $decimalpoints); } - if (!empty($item->outcomeid)) { - $data->{'outcome_'.$item->outcomeid} = 1; - } } // set category if present