mirror of
https://github.com/moodle/moodle.git
synced 2025-03-14 12:40:01 +01:00
MDL-71163 mod_assign: remove duplicate available from and due date info
This commit is contained in:
parent
940f57d519
commit
7dbd7ee195
@ -21,5 +21,5 @@ Feature: Transform date time string arguments
|
||||
And I log in as "teacher1"
|
||||
And I am on "Course 1" course homepage
|
||||
And I follow "Test assignment name"
|
||||
And I should see "##yesterday##%A, %d %B %Y##"
|
||||
And I should see "##yesterday##%d %B %Y##"
|
||||
And I log out
|
||||
|
@ -19,15 +19,16 @@ Feature: Any day / month / year combination in date form elements works ok.
|
||||
And I set the field "Due date" to "<initial_date>"
|
||||
And I set the field "Due date" to "<final_date>"
|
||||
When I press "Save and display"
|
||||
Then I should see "<date_result>" in the "Due date" "table_row"
|
||||
Then the activity date in "Assignment 01" should contain "Due:"
|
||||
And the activity date in "Assignment 01" should contain "<date_result>"
|
||||
|
||||
Examples:
|
||||
| initial_date | final_date | date_result | case_explanation (times Australia/Perth) |
|
||||
| ##today## | ##tomorrow noon## | ##tomorrow noon##%A, %d %B %Y, %I:%M## | change of day, any day, back and forth |
|
||||
| ##tomorrow## | ##today noon## | ##today noon##%A, %d %B %Y, %I:%M## | |
|
||||
| 1617256800 | 1617170400 | Wednesday, 31 March 2021, 2:00 | change of month, back and forth |
|
||||
| 1617170400 | 1617256800 | Thursday, 1 April 2021, 2:00 | |
|
||||
| 1740808800 | 1709186400 | Thursday, 29 February 2024, 2:00 | change of month, leap year, back and forth |
|
||||
| 1709186400 | 1740808800 | Saturday, 1 March 2025, 2:00 | |
|
||||
| 1577858400 | 1577772000 | Tuesday, 31 December 2019, 2:00 | change of year, back and forth |
|
||||
| 1577772000 | 1577858400 | Wednesday, 1 January 2020, 2:00 | |
|
||||
| ##today## | ##tomorrow noon## | ##tomorrow noon##%d %B %Y, %I:%M %p## | change of day, any day, back and forth |
|
||||
| ##tomorrow## | ##today noon## | ##today noon##%d %B %Y, %I:%M %p## | |
|
||||
| 1617256800 | 1617170400 | 31 March 2021, 2:00 PM | change of month, back and forth |
|
||||
| 1617170400 | 1617256800 | 1 April 2021, 2:00 PM | |
|
||||
| 1740808800 | 1709186400 | 29 February 2024, 2:00 PM | change of month, leap year, back and forth |
|
||||
| 1709186400 | 1740808800 | 1 March 2025, 2:00 PM | |
|
||||
| 1577858400 | 1577772000 | 31 December 2019, 2:00 PM | change of year, back and forth |
|
||||
| 1577772000 | 1577858400 | 1 January 2020, 2:00 PM | |
|
||||
|
@ -22,9 +22,9 @@
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
|
||||
$string['activitydate:submissionsdue'] = 'Submissions due:';
|
||||
$string['activitydate:submissionsopen'] = 'Submissions open:';
|
||||
$string['activitydate:submissionsopened'] = 'Submissions opened:';
|
||||
$string['activitydate:submissionsdue'] = 'Due:';
|
||||
$string['activitydate:submissionsopen'] = 'Opens:';
|
||||
$string['activitydate:submissionsopened'] = 'Opened:';
|
||||
$string['activityoverview'] = 'You have assignments that need attention';
|
||||
$string['addsubmission'] = 'Add submission';
|
||||
$string['addsubmission_help'] = 'You have not made a submission yet.';
|
||||
@ -41,8 +41,6 @@ $string['allowsubmissions'] = 'Allow the user to continue making submissions to
|
||||
$string['allowsubmissionsshort'] = 'Allow submission changes';
|
||||
$string['allowsubmissionsfromdate'] = 'Allow submissions from';
|
||||
$string['allowsubmissionsfromdate_help'] = 'If enabled, students will not be able to submit before this date. If disabled, students will be able to start submitting right away.';
|
||||
$string['allowsubmissionsfromdatesummary'] = 'This assignment will accept submissions from <strong>{$a}</strong>';
|
||||
$string['allowsubmissionsanddescriptionfromdatesummary'] = 'The assignment details and submission form will be available from <strong>{$a}</strong>';
|
||||
$string['alwaysshowdescription'] = 'Always show description';
|
||||
$string['alwaysshowdescription_help'] = 'If disabled, the assignment description above will only become visible to students on the "Allow submissions from" date.';
|
||||
$string['applytoteam'] = 'Apply grades and feedback to entire group';
|
||||
@ -640,5 +638,7 @@ $string['notsubmittedyet'] = 'Not submitted yet';
|
||||
$string['submissionsnotgraded'] = 'Submissions not graded: {$a}';
|
||||
|
||||
// Deprecated since Moodle 3.11.
|
||||
$string['allowsubmissionsfromdatesummary'] = 'This assignment will accept submissions from <strong>{$a}</strong>';
|
||||
$string['allowsubmissionsanddescriptionfromdatesummary'] = 'The assignment details and submission form will be available from <strong>{$a}</strong>';
|
||||
$string['relativedatessubmissionduedateafter'] = '{$a->datediffstr} after course start';
|
||||
$string['relativedatessubmissionduedatebefore'] = '{$a->datediffstr} before course start';
|
||||
|
@ -1,3 +1,5 @@
|
||||
allowsubmissionsfromdatesummary,mod_assign
|
||||
allowsubmissionsanddescriptionfromdatesummary,mod_assign
|
||||
duedateno,mod_assign
|
||||
mysubmission,mod_assign
|
||||
nolatesubmissions,mod_assign
|
||||
|
@ -335,26 +335,8 @@ class mod_assign_renderer extends plugin_renderer_base {
|
||||
|
||||
$time = time();
|
||||
if ($summary->duedate) {
|
||||
// Due date.
|
||||
$cell1content = get_string('duedate', 'assign');
|
||||
$duedate = $summary->duedate;
|
||||
if ($summary->courserelativedatesmode) {
|
||||
// Returns a formatted string, in the format '10d 10h 45m'.
|
||||
$diffstr = get_time_interval_string($duedate, $summary->coursestartdate);
|
||||
if ($duedate >= $summary->coursestartdate) {
|
||||
$cell2content = get_string('relativedatessubmissionduedateafter', 'core_course',
|
||||
['datediffstr' => $diffstr]);
|
||||
} else {
|
||||
$cell2content = get_string('relativedatessubmissionduedatebefore', 'core_course',
|
||||
['datediffstr' => $diffstr]);
|
||||
}
|
||||
} else {
|
||||
$cell2content = userdate($duedate);
|
||||
}
|
||||
|
||||
$this->add_table_row_tuple($t, $cell1content, $cell2content);
|
||||
|
||||
// Time remaining.
|
||||
$duedate = $summary->duedate;
|
||||
$cell1content = get_string('timeremaining', 'assign');
|
||||
if ($summary->courserelativedatesmode) {
|
||||
$cell2content = get_string('relativedatessubmissiontimeleft', 'mod_assign');
|
||||
@ -667,18 +649,6 @@ class mod_assign_renderer extends plugin_renderer_base {
|
||||
$o .= $this->output->heading(get_string('submissionstatusheading', 'assign'), 3);
|
||||
$time = time();
|
||||
|
||||
if ($status->allowsubmissionsfromdate &&
|
||||
$time <= $status->allowsubmissionsfromdate) {
|
||||
$o .= $this->output->box_start('generalbox boxaligncenter submissionsalloweddates');
|
||||
if ($status->alwaysshowdescription) {
|
||||
$date = userdate($status->allowsubmissionsfromdate);
|
||||
$o .= get_string('allowsubmissionsfromdatesummary', 'assign', $date);
|
||||
} else {
|
||||
$date = userdate($status->allowsubmissionsfromdate);
|
||||
$o .= get_string('allowsubmissionsanddescriptionfromdatesummary', 'assign', $date);
|
||||
}
|
||||
$o .= $this->output->box_end();
|
||||
}
|
||||
$o .= $this->output->box_start('boxaligncenter submissionsummarytable');
|
||||
|
||||
$t = new html_table();
|
||||
@ -810,11 +780,6 @@ class mod_assign_renderer extends plugin_renderer_base {
|
||||
$submission = $status->teamsubmission ? $status->teamsubmission : $status->submission;
|
||||
$duedate = $status->duedate;
|
||||
if ($duedate > 0) {
|
||||
// Due date.
|
||||
$cell1content = get_string('duedate', 'assign');
|
||||
$cell2content = userdate($duedate);
|
||||
$this->add_table_row_tuple($t, $cell1content, $cell2content);
|
||||
|
||||
if ($status->view == assign_submission_status::GRADER_VIEW) {
|
||||
if ($status->cutoffdate) {
|
||||
// Cut off date.
|
||||
|
@ -93,12 +93,12 @@ Feature: Assign group override
|
||||
And I log in as "student2"
|
||||
And I am on "Course 1" course homepage
|
||||
And I follow "Test assignment name"
|
||||
Then I should see "Saturday, 1 January 2000, 8:00"
|
||||
Then the activity date in "Test assignment name" should contain "Due: 1 January 2000, 8:00 AM"
|
||||
And I log out
|
||||
And I log in as "student1"
|
||||
And I am on "Course 1" course homepage
|
||||
And I follow "Test assignment name"
|
||||
And I should see "Wednesday, 1 January 2020, 8:00"
|
||||
And the activity date in "Test assignment name" should contain "Due: 1 January 2020, 8:00 AM"
|
||||
|
||||
Scenario: Allow a group to have a different cut off date
|
||||
Given I log in as "teacher1"
|
||||
@ -149,13 +149,13 @@ Feature: Assign group override
|
||||
And I log in as "student2"
|
||||
And I am on "Course 1" course homepage
|
||||
And I follow "Test assignment name"
|
||||
Then I should see "This assignment will accept submissions from Tuesday, 1 January 2030, 8:00"
|
||||
Then the activity date in "Test assignment name" should contain "Opens: 1 January 2030, 8:00 AM"
|
||||
And I should not see "Add submission"
|
||||
And I log out
|
||||
And I log in as "student1"
|
||||
And I am on "Course 1" course homepage
|
||||
And I follow "Test assignment name"
|
||||
And I should not see "This assignment will accept submissions from Tuesday, 1 January 2030, 8:00"
|
||||
And I should not see "1 January 2030, 8:00 AM"
|
||||
|
||||
@javascript
|
||||
Scenario: Add both a user and group override and verify that both are applied correctly
|
||||
@ -187,17 +187,17 @@ Feature: Assign group override
|
||||
Then I log in as "student1"
|
||||
And I am on "Course 1" course homepage
|
||||
And I follow "Test assignment name"
|
||||
And I should see "This assignment will accept submissions from Wednesday, 1 January 2031, 8:00"
|
||||
And the activity date in "Test assignment name" should contain "Opens: 1 January 2031, 8:00 AM"
|
||||
And I log out
|
||||
And I log in as "student2"
|
||||
And I am on "Course 1" course homepage
|
||||
And I follow "Test assignment name"
|
||||
And I should see "This assignment will accept submissions from Sunday, 1 January 2040, 8:00"
|
||||
And the activity date in "Test assignment name" should contain "Opens: 1 January 2040, 8:00 AM"
|
||||
And I log out
|
||||
And I log in as "student3"
|
||||
And I am on "Course 1" course homepage
|
||||
And I follow "Test assignment name"
|
||||
And I should see "This assignment will accept submissions from Tuesday, 1 January 2030, 8:00"
|
||||
And the activity date in "Test assignment name" should contain "Opens: 1 January 2030, 8:00 AM"
|
||||
|
||||
Scenario: Override a group when teacher is in no group, and does not have accessallgroups permission, and the activity's group mode is "separate groups"
|
||||
Given the following "permission overrides" exist:
|
||||
|
@ -85,12 +85,12 @@ Feature: Assign user override
|
||||
And I log in as "student2"
|
||||
And I am on "Course 1" course homepage
|
||||
And I follow "Test assignment name"
|
||||
Then I should see "Saturday, 1 January 2000, 8:00"
|
||||
Then the activity date in "Test assignment name" should contain "Due: 1 January 2000, 8:00 AM"
|
||||
And I log out
|
||||
And I log in as "student1"
|
||||
And I am on "Course 1" course homepage
|
||||
And I follow "Test assignment name"
|
||||
And I should see "Wednesday, 1 January 2020, 8:00"
|
||||
And the activity date in "Test assignment name" should contain "Due: 1 January 2020, 8:00 AM"
|
||||
|
||||
@javascript
|
||||
Scenario: Allow a user to have a different cut off date
|
||||
@ -143,12 +143,12 @@ Feature: Assign user override
|
||||
And I log in as "student2"
|
||||
And I am on "Course 1" course homepage
|
||||
And I follow "Test assignment name"
|
||||
Then I should see "This assignment will accept submissions from Tuesday, 1 January 2030, 8:00"
|
||||
Then the activity date in "Test assignment name" should contain "Opens: 1 January 2030, 8:00 AM"
|
||||
And I log out
|
||||
And I log in as "student1"
|
||||
And I am on "Course 1" course homepage
|
||||
And I follow "Test assignment name"
|
||||
And I should not see "This assignment will accept submissions from Tuesday, 1 January 2030, 8:00"
|
||||
And I should not see "1 January 2030, 8:00 AM"
|
||||
|
||||
Scenario: Override a user when teacher is in no group, and does not have accessallgroups permission, and the activity's group mode is "separate groups"
|
||||
Given the following "permission overrides" exist:
|
||||
|
@ -82,7 +82,7 @@ I should be able to create an assignment with a due date relative to the course
|
||||
And I log in as "teacher1"
|
||||
And I am on "Course 1" course homepage
|
||||
And I follow "Test assignment name"
|
||||
And I should see "after course start" in the "Due date" "table_row"
|
||||
And the activity date in "Test assignment name" should contain "after course start"
|
||||
And I should see "Calculated for each student" in the "Time remaining" "table_row"
|
||||
When I navigate to "View all submissions" in current page administration
|
||||
Then I should see "No submission" in the "Student 1" "table_row"
|
||||
|
@ -43,8 +43,8 @@ Feature: Set availability dates for an assignment
|
||||
And I am on "Course 1" course homepage
|
||||
When I follow "Assignment name"
|
||||
Then "Add submission" "button" should not exist
|
||||
And I should see "This assignment will accept submissions from"
|
||||
And I should see "##tomorrow noon##%A, %d %B %Y, %I:%M %p##"
|
||||
And the activity date in "Assignment name" should contain "Opens:"
|
||||
And the activity date in "Assignment name" should contain "##tomorrow noon##%d %B %Y, %I:%M %p##"
|
||||
|
||||
Scenario: Student can see the assignment's due date in the course calendar
|
||||
Given I log in as "teacher1"
|
||||
@ -82,7 +82,8 @@ Feature: Set availability dates for an assignment
|
||||
And I log in as "student1"
|
||||
And I am on "Course 1" course homepage
|
||||
And I follow "Assignment name"
|
||||
And I should see "##+2 days 5 hours 30 minutes##%A, %d %B %Y##" in the "Due date" "table_row"
|
||||
And the activity date in "Assignment name" should contain "Due:"
|
||||
And the activity date in "Assignment name" should contain "##+2 days 5 hours 30 minutes##%d %B %Y##"
|
||||
And I should see "2 days 5 hours" in the "Time remaining" "table_row"
|
||||
And "Add submission" "button" should exist
|
||||
And I press "Add submission"
|
||||
@ -115,7 +116,8 @@ Feature: Set availability dates for an assignment
|
||||
And I log in as "student1"
|
||||
And I am on "Course 1" course homepage
|
||||
And I follow "Assignment name"
|
||||
And I should see "##2 days 5 hours 30 minutes ago##%A, %d %B %Y##" in the "Due date" "table_row"
|
||||
And the activity date in "Assignment name" should contain "Due:"
|
||||
And the activity date in "Assignment name" should contain "##2 days 5 hours 30 minutes ago##%d %B %Y##"
|
||||
And I should see "Assignment is overdue by: 2 days 5 hours" in the "Time remaining" "table_row"
|
||||
And "Add submission" "button" should exist
|
||||
And I press "Add submission"
|
||||
|
@ -4219,10 +4219,44 @@ Anchor link 2:<a title=\"bananas\" href=\"../logo-240x60.gif\">Link text</a>
|
||||
}
|
||||
|
||||
/**
|
||||
* Test showing group override duedate for admin
|
||||
* Data provider for test_view_group_override
|
||||
*
|
||||
* @return array Provider data
|
||||
*/
|
||||
public function test_view_group_override() {
|
||||
global $DB, $PAGE;
|
||||
public function view_group_override_provider() {
|
||||
return [
|
||||
'Other users should see their duedate' => [
|
||||
'student',
|
||||
['group2'],
|
||||
'group1',
|
||||
'7 June 2019, 5:37 PM',
|
||||
],
|
||||
'Teacher should be able to see all group override duedate' => [
|
||||
'teacher',
|
||||
['group1'],
|
||||
'group1',
|
||||
'20 September 2019, 10:37 PM',
|
||||
],
|
||||
'Teacher should be able to see all group override duedate even if they are not member' => [
|
||||
'editingteacher',
|
||||
['group1'],
|
||||
'group2',
|
||||
'7 June 2019, 5:37 PM',
|
||||
]
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* Test showing group override duedate for admin
|
||||
*
|
||||
* @dataProvider view_group_override_provider
|
||||
* @param string $role the role of the user (teacher, student, etc)
|
||||
* @param string[] $groups the groups the user are member of
|
||||
* @param string $activegroup The selected group
|
||||
* @param string $expecteddate The expected due date
|
||||
*/
|
||||
public function test_view_group_override(string $role, array $groups, string $activegroup, string $expecteddate) {
|
||||
global $DB, $PAGE, $SESSION;
|
||||
|
||||
$this->resetAfterTest();
|
||||
$course = $this->getDataGenerator()->create_course();
|
||||
@ -4230,17 +4264,18 @@ Anchor link 2:<a title=\"bananas\" href=\"../logo-240x60.gif\">Link text</a>
|
||||
$group1 = $this->getDataGenerator()->create_group(['courseid' => $course->id]);
|
||||
$group2 = $this->getDataGenerator()->create_group(['courseid' => $course->id]);
|
||||
|
||||
$student1 = $this->getDataGenerator()->create_and_enrol($course, 'student');
|
||||
$teacher = $this->getDataGenerator()->create_and_enrol($course, 'teacher');
|
||||
groups_add_member($group1, $student1);
|
||||
groups_add_member($group1, $teacher);
|
||||
|
||||
$student2 = $this->getDataGenerator()->create_and_enrol($course, 'student');
|
||||
groups_add_member($group2, $student2);
|
||||
$user = $this->getDataGenerator()->create_and_enrol($course, $role);
|
||||
if (in_array('group1', $groups)) {
|
||||
groups_add_member($group1, $user);
|
||||
}
|
||||
if (in_array('group2', $groups)) {
|
||||
groups_add_member($group2, $user);
|
||||
}
|
||||
$activegroup = $$activegroup;
|
||||
|
||||
$assign = $this->create_instance($course, [
|
||||
'groupmode' => 1,
|
||||
'duedate' => 1558999899,
|
||||
'groupmode' => SEPARATEGROUPS,
|
||||
'duedate' => 1558999899, // 28 May 2019, 7:31 AM.
|
||||
]);
|
||||
$instance = $assign->get_instance();
|
||||
|
||||
@ -4251,14 +4286,14 @@ Anchor link 2:<a title=\"bananas\" href=\"../logo-240x60.gif\">Link text</a>
|
||||
'groupid' => $group1->id,
|
||||
'userid' => null,
|
||||
'sortorder' => 1,
|
||||
'duedate' => 1568990258,
|
||||
'duedate' => 1568990258, // 20 September 2019, 10:37 PM.
|
||||
],
|
||||
(object) [
|
||||
'assignid' => $instance->id,
|
||||
'groupid' => $group2->id,
|
||||
'userid' => null,
|
||||
'sortorder' => 2,
|
||||
'duedate' => 1559900258,
|
||||
'duedate' => 1559900258, // 7 June 2019, 5:37 PM.
|
||||
],
|
||||
];
|
||||
|
||||
@ -4266,25 +4301,21 @@ Anchor link 2:<a title=\"bananas\" href=\"../logo-240x60.gif\">Link text</a>
|
||||
$override->id = $DB->insert_record('assign_overrides', $override);
|
||||
}
|
||||
|
||||
$currenturl = new moodle_url('/mod/assign/view.php', array('id' => $assign->get_course_module()->id));
|
||||
$currenturl = new moodle_url('/mod/assign/view.php', ['id' => $assign->get_course_module()->id]);
|
||||
$PAGE->set_url($currenturl);
|
||||
$output1 = '';
|
||||
// Other users should see duedate of the assignment.
|
||||
$this->setUser($student2);
|
||||
$summary = $assign->get_assign_grading_summary_renderable($group1->id);
|
||||
$output1 .= $assign->get_renderer()->render($summary);
|
||||
$this->assertStringContainsStringIgnoringCase('Tuesday, 28 May 2019, 7:31 AM', $output1);
|
||||
|
||||
$output2 = '';
|
||||
// Teacher should be able to see all group override duedate.
|
||||
$this->setUser($teacher);
|
||||
$summary = $assign->get_assign_grading_summary_renderable($group1->id);
|
||||
$output2 .= $assign->get_renderer()->render($summary);
|
||||
$this->assertStringContainsStringIgnoringCase('Friday, 20 September 2019, 10:37 PM', $output2);
|
||||
$summary = $assign->get_assign_grading_summary_renderable($group2->id);
|
||||
$output3 = '';
|
||||
$output3 .= $assign->get_renderer()->render($summary);
|
||||
$this->assertStringContainsStringIgnoringCase('Friday, 7 June 2019, 5:37 PM', $output3);
|
||||
$this->setUser($user);
|
||||
$_GET['group'] = $activegroup->id;
|
||||
|
||||
/** @var assign $assign */
|
||||
$header = new assign_header(
|
||||
$assign->get_instance(),
|
||||
$assign->get_context(),
|
||||
false,
|
||||
$assign->get_course_module()->id
|
||||
);
|
||||
$output = $assign->get_renderer()->render($header);
|
||||
$this->assertStringContainsStringIgnoringCase($expecteddate, $output);
|
||||
}
|
||||
|
||||
/**
|
||||
|
Loading…
x
Reference in New Issue
Block a user