MDL-60058 assign: show due date calendar event for teachers
authorRyan Wyllie <ryan@moodle.com>
Mon, 18 Sep 2017 03:52:10 +0000 (03:52 +0000)
committerRyan Wyllie <ryan@moodle.com>
Tue, 10 Oct 2017 03:51:18 +0000 (03:51 +0000)
mod/assign/lib.php
mod/assign/tests/lib_test.php

index 4e7c7ec..7572645 100644 (file)
@@ -1823,8 +1823,7 @@ function assign_check_updates_since(cm_info $cm, $from, $filter = array()) {
  * Is the event visible?
  *
  * This is used to determine global visibility of an event in all places throughout Moodle. For example,
- * the ASSIGN_EVENT_TYPE_GRADINGDUE event will not be shown to students on their calendar, and
- * ASSIGN_EVENT_TYPE_DUE events will not be shown to teachers.
+ * the ASSIGN_EVENT_TYPE_GRADINGDUE event will not be shown to students on their calendar.
  *
  * @param calendar_event $event
  * @return bool Returns true if the event is visible to the current user, false otherwise.
@@ -1842,7 +1841,7 @@ function mod_assign_core_calendar_is_event_visible(calendar_event $event) {
     if ($event->eventtype == ASSIGN_EVENT_TYPE_GRADINGDUE) {
         return $assign->can_grade();
     } else {
-        return !$assign->can_grade() && $assign->can_view_submission($USER->id);
+        return true;
     }
 }
 
index 322cb85..c59504f 100644 (file)
@@ -108,7 +108,7 @@ class mod_assign_lib_testcase extends mod_assign_base_testcase {
         $this->setAdminUser();
         $courses = $DB->get_records('course', array('id' => $this->course->id));
         // Past assignments should not show up.
-        $pastassign = $this->create_instance(array('duedate' => time(),
+        $pastassign = $this->create_instance(array('duedate' => time() - 370001,
                                                    'cutoffdate' => time() - 370000,
                                                    'nosubmissions' => 0,
                                                    'assignsubmission_onlinetext_enabled' => 1));
@@ -413,8 +413,8 @@ class mod_assign_lib_testcase extends mod_assign_base_testcase {
         // Set the user to a teacher.
         $this->setUser($this->editingteachers[0]);
 
-        // The teacher should not care about the due date event.
-        $this->assertFalse(mod_assign_core_calendar_is_event_visible($event));
+        // The teacher should see the due date event.
+        $this->assertTrue(mod_assign_core_calendar_is_event_visible($event));
     }
 
     public function test_assign_core_calendar_is_event_visible_duedate_event_as_student() {