From daff66b1dff151f898604e715a35c8c8f743158f Mon Sep 17 00:00:00 2001 From: Shamim Rezaie Date: Tue, 4 May 2021 10:32:18 +1000 Subject: [PATCH] MDL-71518 core: Add weekday to activity dates --- course/classes/output/activity_information.php | 2 +- lib/tests/behat/datetime_any.feature | 18 +++++++++--------- mod/assign/tests/behat/assign_group_override.feature | 14 +++++++------- mod/assign/tests/behat/assign_user_override.feature | 6 +++--- mod/assign/tests/behat/relative_dates.feature | 2 +- mod/assign/tests/behat/set_availability.feature | 6 +++--- mod/lesson/tests/behat/date_availability.feature | 4 ++-- mod/lesson/tests/behat/lesson_group_override.feature | 10 +++++----- mod/lesson/tests/behat/lesson_user_override.feature | 4 ++-- 9 files changed, 33 insertions(+), 33 deletions(-) diff --git a/course/classes/output/activity_information.php b/course/classes/output/activity_information.php index 56b763bce0c..c1181f5bb12 100644 --- a/course/classes/output/activity_information.php +++ b/course/classes/output/activity_information.php @@ -94,7 +94,7 @@ class activity_information implements renderable, templatable { protected function build_dates_data(stdClass $data): void { foreach ($this->activitydates as $date) { if (empty($date['relativeto'])) { - $date['datestring'] = userdate($date['timestamp'], get_string('strftimedatetime', 'core_langconfig')); + $date['datestring'] = userdate($date['timestamp'], get_string('strftimedaydatetime', 'core_langconfig')); } else { $diffstr = get_time_interval_string($date['timestamp'], $date['relativeto']); if ($date['timestamp'] >= $date['relativeto']) { diff --git a/lib/tests/behat/datetime_any.feature b/lib/tests/behat/datetime_any.feature index 8a61a72a8e4..385b26363ae 100644 --- a/lib/tests/behat/datetime_any.feature +++ b/lib/tests/behat/datetime_any.feature @@ -23,12 +23,12 @@ Feature: Any day / month / year combination in date form elements works ok. And the activity date in "Assignment 01" should contain "" Examples: - | initial_date | final_date | date_result | case_explanation (times Australia/Perth) | - | ##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 | | + | initial_date | final_date | date_result | case_explanation (times Australia/Perth) | + | ##today## | ##tomorrow noon## | ##tomorrow noon##%A, %d %B %Y, %I:%M %p## | change of day, any day, back and forth | + | ##tomorrow## | ##today noon## | ##today noon##%A, %d %B %Y, %I:%M %p## | | + | 1617256800 | 1617170400 | Wednesday, 31 March 2021, 2:00 PM | change of month, back and forth | + | 1617170400 | 1617256800 | Thursday, 1 April 2021, 2:00 PM | | + | 1740808800 | 1709186400 | Thursday, 29 February 2024, 2:00 PM | change of month, leap year, back and forth | + | 1709186400 | 1740808800 | Saturday, 1 March 2025, 2:00 PM | | + | 1577858400 | 1577772000 | Tuesday, 31 December 2019, 2:00 PM | change of year, back and forth | + | 1577772000 | 1577858400 | Wednesday, 1 January 2020, 2:00 PM | | diff --git a/mod/assign/tests/behat/assign_group_override.feature b/mod/assign/tests/behat/assign_group_override.feature index 3b66e5f11b1..5fc69671154 100644 --- a/mod/assign/tests/behat/assign_group_override.feature +++ b/mod/assign/tests/behat/assign_group_override.feature @@ -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 the activity date in "Test assignment name" should contain "Due: 1 January 2000, 8:00 AM" + Then the activity date in "Test assignment name" should contain "Due: Saturday, 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 the activity date in "Test assignment name" should contain "Due: 1 January 2020, 8:00 AM" + And the activity date in "Test assignment name" should contain "Due: Wednesday, 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 the activity date in "Test assignment name" should contain "Opens: 1 January 2030, 8:00 AM" + Then the activity date in "Test assignment name" should contain "Opens: Tuesday, 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 "1 January 2030, 8:00 AM" + And I should not see "Tuesday, 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 the activity date in "Test assignment name" should contain "Opens: 1 January 2031, 8:00 AM" + And the activity date in "Test assignment name" should contain "Opens: Wednesday, 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 the activity date in "Test assignment name" should contain "Opens: 1 January 2040, 8:00 AM" + And the activity date in "Test assignment name" should contain "Opens: Sunday, 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 the activity date in "Test assignment name" should contain "Opens: 1 January 2030, 8:00 AM" + And the activity date in "Test assignment name" should contain "Opens: Tuesday, 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: diff --git a/mod/assign/tests/behat/assign_user_override.feature b/mod/assign/tests/behat/assign_user_override.feature index e0fa7355844..0e848919781 100644 --- a/mod/assign/tests/behat/assign_user_override.feature +++ b/mod/assign/tests/behat/assign_user_override.feature @@ -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 the activity date in "Test assignment name" should contain "Due: 1 January 2000, 8:00 AM" + Then the activity date in "Test assignment name" should contain "Due: Saturday, 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 the activity date in "Test assignment name" should contain "Due: 1 January 2020, 8:00 AM" + And the activity date in "Test assignment name" should contain "Due: Wednesday, 1 January 2020, 8:00 AM" @javascript Scenario: Allow a user to have a different cut off date @@ -143,7 +143,7 @@ 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 the activity date in "Test assignment name" should contain "Opens: 1 January 2030, 8:00 AM" + Then the activity date in "Test assignment name" should contain "Opens: Tuesday, 1 January 2030, 8:00 AM" And I log out And I log in as "student1" And I am on "Course 1" course homepage diff --git a/mod/assign/tests/behat/relative_dates.feature b/mod/assign/tests/behat/relative_dates.feature index d4d93e54ac4..d42d2de6ee6 100644 --- a/mod/assign/tests/behat/relative_dates.feature +++ b/mod/assign/tests/behat/relative_dates.feature @@ -56,7 +56,7 @@ I should be able to create an assignment with a due date relative to the course When I log in as "student1" And I am on "Course 1" course homepage And I follow "Test assignment name" - Then the activity date in "Test assignment name" should contain "Due: 7 January 2021, 8:00 AM" + Then the activity date in "Test assignment name" should contain "Due: Thursday, 7 January 2021, 8:00 AM" Scenario: As a teacher, I should see the relative dates when reviewing assignment submissions Given the following config values are set as admin: diff --git a/mod/assign/tests/behat/set_availability.feature b/mod/assign/tests/behat/set_availability.feature index ddcf7a7c19f..6cebe0a5131 100644 --- a/mod/assign/tests/behat/set_availability.feature +++ b/mod/assign/tests/behat/set_availability.feature @@ -44,7 +44,7 @@ Feature: Set availability dates for an assignment When I follow "Assignment name" Then "Add submission" "button" should not exist 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##" + And the activity date in "Assignment name" should contain "##tomorrow noon##%A, %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" @@ -83,7 +83,7 @@ Feature: Set availability dates for an assignment And I am on "Course 1" course homepage And I follow "Assignment name" 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 the activity date in "Assignment name" should contain "##+2 days 5 hours 30 minutes##%A, %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" @@ -117,7 +117,7 @@ Feature: Set availability dates for an assignment And I am on "Course 1" course homepage And I follow "Assignment name" 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 the activity date in "Assignment name" should contain "##2 days 5 hours 30 minutes ago##%A, %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" diff --git a/mod/lesson/tests/behat/date_availability.feature b/mod/lesson/tests/behat/date_availability.feature index 52816ec3c87..dab2f51f8b8 100644 --- a/mod/lesson/tests/behat/date_availability.feature +++ b/mod/lesson/tests/behat/date_availability.feature @@ -45,7 +45,7 @@ Feature: A teacher can set available from and deadline dates to access a lesson And I log in as "student1" And I am on "Course 1" course homepage When I follow "Test lesson" - Then the activity date in "Test lesson" should contain "Opens: 1 January 2030, 8:00 AM" + Then the activity date in "Test lesson" should contain "Opens: Tuesday, 1 January 2030, 8:00 AM" And I should not see "First page contents" Scenario: Forbidding lesson accesses after a specified date @@ -74,5 +74,5 @@ Feature: A teacher can set available from and deadline dates to access a lesson And I log in as "student1" And I am on "Course 1" course homepage When I follow "Test lesson" - Then the activity date in "Test lesson" should contain "Closed: 1 January 2000, 8:00 AM" + Then the activity date in "Test lesson" should contain "Closed: Saturday, 1 January 2000, 8:00 AM" And I should not see "First page contents" diff --git a/mod/lesson/tests/behat/lesson_group_override.feature b/mod/lesson/tests/behat/lesson_group_override.feature index 5d3c03f4802..3071b888d8b 100644 --- a/mod/lesson/tests/behat/lesson_group_override.feature +++ b/mod/lesson/tests/behat/lesson_group_override.feature @@ -216,7 +216,7 @@ Feature: Lesson group override And I log in as "student2" And I am on "Course 1" course homepage And I follow "Test lesson name" - Then the activity date in "Test lesson name" should contain "Closed: 1 January 2000, 8:00 AM" + Then the activity date in "Test lesson name" should contain "Closed: Saturday, 1 January 2000, 8:00 AM" And I should not see "Cat is an amphibian" And I log out And I log in as "student1" @@ -253,7 +253,7 @@ Feature: Lesson group override And I log in as "student2" And I am on "Course 1" course homepage And I follow "Test lesson name" - Then the activity date in "Test lesson name" should contain "Opens: 1 January 2030, 8:00 AM" + Then the activity date in "Test lesson name" should contain "Opens: Tuesday, 1 January 2030, 8:00 AM" And I should not see "Cat is an amphibian" And I log out And I log in as "student1" @@ -346,17 +346,17 @@ Feature: Lesson group override Then I log in as "student1" And I am on "Course 1" course homepage And I follow "Test lesson name" - And the activity date in "Test lesson name" should contain "Opens: 1 January 2031, 8:00 AM" + And the activity date in "Test lesson name" should contain "Opens: Wednesday, 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 lesson name" - And the activity date in "Test lesson name" should contain "Opens: 1 January 2040, 8:00 AM" + And the activity date in "Test lesson name" should contain "Opens: Sunday, 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 lesson name" - And the activity date in "Test lesson name" should contain "Opens: 1 January 2030, 8:00 AM" + And the activity date in "Test lesson name" should contain "Opens: Tuesday, 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: diff --git a/mod/lesson/tests/behat/lesson_user_override.feature b/mod/lesson/tests/behat/lesson_user_override.feature index c738d3aebed..3b92b919802 100644 --- a/mod/lesson/tests/behat/lesson_user_override.feature +++ b/mod/lesson/tests/behat/lesson_user_override.feature @@ -211,7 +211,7 @@ Feature: Lesson user override And I am on "Course 1" course homepage And I follow "Test lesson name" And I wait until the page is ready - Then the activity date in "Test lesson name" should contain "Closed: 1 January 2000, 8:00 AM" + Then the activity date in "Test lesson name" should contain "Closed: Saturday, 1 January 2000, 8:00 AM" And I should not see "Cat is an amphibian" And I log out And I log in as "student1" @@ -250,7 +250,7 @@ Feature: Lesson user override And I am on "Course 1" course homepage And I follow "Test lesson name" And I wait until the page is ready - Then the activity date in "Test lesson name" should contain "Opens: 1 January 2030, 8:00 AM" + Then the activity date in "Test lesson name" should contain "Opens: Tuesday, 1 January 2030, 8:00 AM" And I should not see "Cat is an amphibian" And I log out And I log in as "student1" -- 2.11.4.GIT