Skip to content

Commit

Permalink
CTP-3973 behat deadline fix
Browse files Browse the repository at this point in the history
  • Loading branch information
watson8 committed Oct 29, 2024
1 parent 5eb7ae7 commit 5696776
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 5 deletions.
4 changes: 1 addition & 3 deletions classes/controllers/deadline_extensions_controller.php
Original file line number Diff line number Diff line change
Expand Up @@ -226,16 +226,14 @@ public function ajax_submit_mitigation($dataparams) {

public function validation($data) {
global $CFG;
$maxdeadline = $CFG->coursework_max_extension_deadline;

if ($this->coursework->personaldeadlineenabled && $personaldeadline = $this->personal_deadline()) {
$deadline = $personaldeadline->personal_deadline;
} else {
$deadline = $this->coursework->deadline;
}

if ( $data['extended_deadline'] <= $deadline) {
return $errors = 'The new deadline must be later than the current deadline';
return 'The new deadline must be later than the current deadline';
}

return false;
Expand Down
4 changes: 2 additions & 2 deletions tests/behat/behat_mod_coursework.php
Original file line number Diff line number Diff line change
Expand Up @@ -1136,8 +1136,8 @@ public function there_is_an_extension_for_the_student_which_has_expired() {
*/
public function i_enter_an_extension_in_the_form(string $timeextension, string $reasoncode = '') {
$newtime = strtotime('3:30pm', strtotime($timeextension));
// Put into format 30-09-2024 15:47.
$newtimestring = date('d-m-Y H:i', $newtime);
// Put into ISO08601 format.
$newtimestring = date('Y-m-d\TH:i', $newtime);
$script = "const e = document.querySelector('input#extension-extend-deadline');"
. "e.value = '$newtimestring'; e.dispatchEvent(new Event('change'));";
behat_base::execute_script_in_session($this->getSession(), $script);
Expand Down

0 comments on commit 5696776

Please sign in to comment.