MDL-36233 mod_assign: fixed submission time comparison sql and test.

This commit is contained in:
Mike Churchward 2016-11-14 16:04:10 -05:00 committed by Simey Lameze
parent e7059ec5e2
commit 559cfa03f4
2 changed files with 8 additions and 1 deletions

View File

@ -758,7 +758,7 @@ function assign_get_grade_details_for_print_overview(&$unmarkedsubmissions, $sql
g.attemptnumber = s.attemptnumber
WHERE
( g.timemodified is NULL OR
s.timemodified > g.timemodified OR
s.timemodified >= g.timemodified OR
g.grade IS NULL ) AND
s.timemodified IS NOT NULL AND
s.status = ? AND

View File

@ -158,6 +158,13 @@ class mod_assign_lib_testcase extends mod_assign_base_testcase {
$data = new stdClass();
$data->grade = '50.0';
$openassign->testable_apply_grade_to_user($data, $this->students[0]->id, 0);
// The assign_print_overview expects the grade date to be after the submission date.
$graderecord = $DB->get_record('assign_grades', array('assignment' => $openassign->get_instance()->id,
'userid' => $this->students[0]->id, 'attemptnumber' => 0));
$graderecord->timemodified += 1;
$DB->update_record('assign_grades', $graderecord);
$overview = array();
assign_print_overview($courses, $overview);
$this->assertEquals(1, count($overview));