MDL-34377: Fix: assignments overview page shows a unset due date as Epoch and counts...
authorRaymond Wijaya <raymond.wijaya@netspot.com.au>
Thu, 16 Aug 2012 06:31:39 +0000 (14:31 +0800)
committerDan Poltawski <dan@moodle.com>
Mon, 20 Aug 2012 06:11:59 +0000 (14:11 +0800)
mod/assign/index.php

index cde25a4..b90c8ac 100644 (file)
@@ -56,8 +56,13 @@ foreach ($assignments as $assignment) {
     $cm = get_coursemodule_from_instance('assign', $assignment->id, 0, false, MUST_EXIST);
 
     $link = html_writer::link(new moodle_url('/mod/assign/view.php', array('id' => $cm->id)), $assignment->name);
-    $date = userdate($assignment->duedate);
-    $submissions = $DB->count_records('assign_submission', array('assignment'=>$cm->instance));
+    $date = '-';
+    if (!empty($assignment->duedate)) {
+        $date = userdate($assignment->duedate);
+    }
+
+    $params = array('assignment'=>$cm->instance, 'status'=>ASSIGN_SUBMISSION_STATUS_SUBMITTED);
+    $submissions = $DB->count_records('assign_submission', $params);
     $row = array($link, $date, $submissions);
     $table->data[] = $row;