Merge branch 'MDL-71786-405' of https://github.com/paulholden/moodle into MOODLE_405_STABLE

This commit is contained in:
ferran
2025-09-02 17:03:50 +02:00
2 changed files with 19 additions and 9 deletions
+7 -6
View File
@@ -1316,12 +1316,13 @@ class assign {
// Any changes to the list of dates that needs to be rolled should be same during course restore and course reset.
// See MDL-9367.
shift_course_mod_dates(
'assign',
['duedate', 'allowsubmissionsfromdate', 'cutoffdate'],
$data->timeshift,
$data->courseid, $this->get_instance()->id,
);
shift_course_mod_dates('assign', [
'allowsubmissionsfromdate',
'duedate',
'cutoffdate',
'gradingduedate',
], $data->timeshift, $data->courseid, $this->get_instance()->id);
$status[] = [
'component' => $componentstr,
'item' => get_string('date'),
+12 -3
View File
@@ -613,6 +613,9 @@ final class locallib_test extends \advanced_testcase {
$this->assertEquals(true, $assign->delete_instance());
}
/**
* @covers ::assign_reset_userdata
*/
public function test_reset_userdata(): void {
global $DB;
@@ -624,9 +627,12 @@ final class locallib_test extends \advanced_testcase {
$now = time();
$this->setUser($teacher);
$assign = $this->create_instance($course, [
'assignsubmission_onlinetext_enabled' => 1,
'duedate' => $now,
]);
'assignsubmission_onlinetext_enabled' => 1,
'allowsubmissionsfromdate' => $now - HOURSECS,
'duedate' => $now,
'cutoffdate' => $now + HOURSECS,
'gradingduedate' => $now + DAYSECS,
]);
// Simulate adding a grade.
$this->add_submission($student, $assign);
@@ -659,7 +665,10 @@ final class locallib_test extends \advanced_testcase {
// Reload the instance data.
$instance = $DB->get_record('assign', ['id' => $assign->get_instance()->id]);
$this->assertEquals($now - HOURSECS + DAYSECS, $instance->allowsubmissionsfromdate);
$this->assertEquals($now + DAYSECS, $instance->duedate);
$this->assertEquals($now + HOURSECS + DAYSECS, $instance->cutoffdate);
$this->assertEquals($now + DAYSECS + DAYSECS, $instance->gradingduedate);
// Test reset using assign_reset_userdata().
$assignduedate = $instance->duedate; // Keep old updated value for comparison.