MDL-37533 Assign: assign_print_overview does not correctly display assignments that...
authorStephen Bourget <sbourget@goffstown.k12.nh.us>
Mon, 21 Jan 2013 16:32:04 +0000 (11:32 -0500)
committerDamyon Wiese <damyon@moodle.com>
Thu, 24 Jan 2013 03:15:55 +0000 (11:15 +0800)
Conflicts:

mod/assign/lib.php

mod/assign/lib.php

index 2058830..f6fd464 100644 (file)
@@ -309,12 +309,24 @@ function assign_print_overview($courses, &$htmlarray) {
     //
     list($sqlassignmentids, $assignmentidparams) = $DB->get_in_or_equal($assignmentids);
 
-    // build up and array of unmarked submissions indexed by assignment id/ userid
-    // for use where the user has grading rights on assignment
-    $rs = $DB->get_recordset_sql("SELECT s.assignment as assignment, s.userid as userid, s.id as id, s.status as status, g.timemodified as timegraded
-                            FROM {assign_submission} s LEFT JOIN {assign_grades} g ON s.userid = g.userid and s.assignment = g.assignment
-                            WHERE g.timemodified = 0 OR s.timemodified > g.timemodified
-                            AND s.assignment $sqlassignmentids", $assignmentidparams);
+    // Build up and array of unmarked submissions indexed by assignment id/ userid
+    // for use where the user has grading rights on assignment.
+    $rs = $DB->get_recordset_sql('SELECT
+                                      s.assignment as assignment,
+                                      s.userid as userid,
+                                      s.id as id,
+                                      s.status as status,
+                                      g.timemodified as timegraded
+                                  FROM {assign_submission} s
+                                  LEFT JOIN {assign_grades} g ON
+                                      s.userid = g.userid AND
+                                      s.assignment = g.assignment
+                                  WHERE
+                                      ( g.timemodified is NULL OR
+                                      s.timemodified > g.timemodified ) AND
+                                      s.timemodified IS NOT NULL AND
+                                      s.status = "submitted" AND
+                                      s.assignment ' . $sqlassignmentids, $assignmentidparams);
 
     $unmarkedsubmissions = array();
     foreach ($rs as $rd) {