MDL-60058 assign: show due date calendar event for teachers

This commit is contained in:
Ryan Wyllie
2017-10-10 03:51:18 +00:00
parent d8e9a23c48
commit 4c1145009a
2 changed files with 5 additions and 6 deletions
+2 -3
View 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;
}
}
+3 -3
View 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() {