Skip to content

Commit

Permalink
MDL-71163 mod_assign: remove duplicate available from and due date info
Browse files Browse the repository at this point in the history
  • Loading branch information
rezaies committed Apr 30, 2021
1 parent 940f57d commit 7dbd7ee
Show file tree
Hide file tree
Showing 10 changed files with 99 additions and 98 deletions.
2 changes: 1 addition & 1 deletion admin/tool/behat/tests/behat/datetime_strings.feature
Expand Up @@ -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 changes: 10 additions & 9 deletions lib/tests/behat/datetime_any.feature
Expand Up @@ -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 | |
10 changes: 5 additions & 5 deletions mod/assign/lang/en/assign.php
Expand Up @@ -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.';
Expand All @@ -41,8 +41,6 @@
$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';
Expand Down Expand Up @@ -640,5 +638,7 @@
$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';
2 changes: 2 additions & 0 deletions mod/assign/lang/en/deprecated.txt
@@ -1,3 +1,5 @@
allowsubmissionsfromdatesummary,mod_assign
allowsubmissionsanddescriptionfromdatesummary,mod_assign
duedateno,mod_assign
mysubmission,mod_assign
nolatesubmissions,mod_assign
Expand Down
37 changes: 1 addition & 36 deletions mod/assign/renderer.php
Expand Up @@ -335,26 +335,8 @@ public function render_assign_grading_summary(assign_grading_summary $summary) {

$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');
Expand Down Expand Up @@ -667,18 +649,6 @@ public function render_assign_submission_status(assign_submission_status $status
$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();
Expand Down Expand Up @@ -810,11 +780,6 @@ public function render_assign_submission_status(assign_submission_status $status
$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.
Expand Down
14 changes: 7 additions & 7 deletions mod/assign/tests/behat/assign_group_override.feature
Expand Up @@ -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"
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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:
Expand Down
8 changes: 4 additions & 4 deletions mod/assign/tests/behat/assign_user_override.feature
Expand Up @@ -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
Expand Down Expand Up @@ -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:
Expand Down
2 changes: 1 addition & 1 deletion mod/assign/tests/behat/relative_dates.feature
Expand Up @@ -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"
Expand Down
10 changes: 6 additions & 4 deletions mod/assign/tests/behat/set_availability.feature
Expand Up @@ -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"
Expand Down Expand Up @@ -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"
Expand Down Expand Up @@ -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"
Expand Down

0 comments on commit 7dbd7ee

Please sign in to comment.