From ee1692e74043c3ac096931a5f3714aeb57e8da27 Mon Sep 17 00:00:00 2001 From: Stephen Bourget Date: Thu, 10 Nov 2011 16:40:32 -0500 Subject: [PATCH] MDL-29529 Assignment: Fix regression (order by status) caused by MDL-27638 --- mod/assignment/lib.php | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/mod/assignment/lib.php b/mod/assignment/lib.php index 0d76a4414e9..750c0ecc986 100644 --- a/mod/assignment/lib.php +++ b/mod/assignment/lib.php @@ -838,7 +838,10 @@ class assignment_base { if ($users) { $select = 'SELECT u.id, u.firstname, u.lastname, u.picture, u.imagealt, s.id AS submissionid, s.grade, s.submissioncomment, - s.timemodified, s.timemarked '; + s.timemodified, s.timemarked, + CASE WHEN s.timemarked > 0 AND s.timemarked >= s.timemodified THEN 1 + ELSE 0 END AS status '; + $sql = 'FROM '.$CFG->prefix.'user u '. 'LEFT JOIN '.$CFG->prefix.'assignment_submissions s ON u.id = s.userid AND s.assignment = '.$this->assignment->id.' '. @@ -850,8 +853,6 @@ class assignment_base { if (($auser = get_records_sql($select.$sql.$sort, $offset+1, 1)) !== false) { $nextuser = array_shift($auser); - /// Calculate user status - $nextuser->status = ($nextuser->timemarked > 0) && ($nextuser->timemarked >= $nextuser->timemodified); $nextid = $nextuser->id; } } @@ -1166,7 +1167,10 @@ class assignment_base { $select = 'SELECT u.id, u.firstname, u.lastname, u.picture, u.imagealt, s.id AS submissionid, s.grade, s.submissioncomment, - s.timemodified, s.timemarked '; + s.timemodified, s.timemarked, + CASE WHEN s.timemarked > 0 AND s.timemarked >= s.timemodified THEN 1 + ELSE 0 END AS status '; + $sql = 'FROM '.$CFG->prefix.'user u '. 'LEFT JOIN '.$CFG->prefix.'assignment_submissions s ON u.id = s.userid AND s.assignment = '.$this->assignment->id.' '. @@ -1192,8 +1196,6 @@ class assignment_base { $locked_overridden = 'overridden'; } - /// Calculate user status - $auser->status = ($auser->timemarked > 0) && ($auser->timemarked >= $auser->timemodified); $picture = print_user_picture($auser, $course->id, $auser->picture, false, true); if (empty($auser->submissionid)) { -- 2.11.4.GIT