MDL-33537 gradingform_rubric Adding the definition when retrieving grading instances
authorDavid Monllao <davidm@moodle.com>
Fri, 20 Jul 2012 06:56:00 +0000 (14:56 +0800)
committerDavid Monllao <davidm@moodle.com>
Fri, 20 Jul 2012 06:57:34 +0000 (14:57 +0800)
Credit to Sam Chaffee

grade/grading/form/rubric/lib.php

index 71b38ec..ae97eee 100644 (file)
@@ -556,7 +556,8 @@ class gradingform_rubric_controller extends gradingform_controller {
             return $this->get_instance($instance);
         }
         if ($itemid && $raterid) {
-            if ($rs = $DB->get_records('grading_instances', array('raterid' => $raterid, 'itemid' => $itemid), 'timemodified DESC', '*', 0, 1)) {
+            $params = array('definitionid' => $this->definition->id, 'raterid' => $raterid, 'itemid' => $itemid);
+            if ($rs = $DB->get_records('grading_instances', $params, 'timemodified DESC', '*', 0, 1)) {
                 $record = reset($rs);
                 $currentinstance = $this->get_current_instance($raterid, $itemid);
                 if ($record->status == gradingform_rubric_instance::INSTANCE_STATUS_INCOMPLETE &&