fixed bug that appeared when teacher grades student with a rubric for the first time

This commit is contained in:
Marina Glancy 2011-11-08 09:14:45 +08:00
parent bb50c37651
commit 050125d47e

View File

@ -504,7 +504,8 @@ class gradingform_rubric_controller extends gradingform_controller {
if ($rs = $DB->get_records('grading_instances', array('raterid' => $raterid, 'itemid' => $itemid), 'timemodified DESC', '*', 0, 1)) {
$record = reset($rs);
$currentinstance = $this->get_current_instance($raterid, $itemid);
if ($record->status == gradingform_rubric_instance::INSTANCE_STATUS_INCOMPLETE && $record->timemodified > $currentinstance->get_data('timemodified')) {
if ($record->status == gradingform_rubric_instance::INSTANCE_STATUS_INCOMPLETE &&
(!$currentinstance || $record->timemodified > $currentinstance->get_data('timemodified'))) {
$record->isrestored = true;
return $this->get_instance($record);
}