Skip to content

Commit

Permalink
WIP: fixing issue with submission
Browse files Browse the repository at this point in the history
  • Loading branch information
dmitriim committed Nov 22, 2024
1 parent 13a25d6 commit 9aff40d
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion classes/local/mod/assign.php
Original file line number Diff line number Diff line change
Expand Up @@ -204,6 +204,13 @@ public function coursemodule_definition_after_data(moodleform_mod $modform, Mood
} else {
$form->setDefault(self::NEW_DUEDATE_FORM_FIELD, 0);
}
} else {
$element = $form->getElement(self::NEW_DUEDATE_FORM_FIELD);
$submittedvalue = $form->getElementValue(self::NEW_DUEDATE_FORM_FIELD);
$exportedvalue = $element->exportValue($submittedvalue);
if (empty($exportedvalue['overridden'])) {
$form->setDefault(self::NEW_DUEDATE_FORM_FIELD, $form->getElementValue('duedate'));
}
}

// This is a very hacky way of making sure that duedate field is set to a new value based on data in the different field.
Expand Down Expand Up @@ -731,7 +738,7 @@ private function build_field_prefix(string $cmid): string {
* @return string
*/
private function build_new_element_name($cmid): string {
return self::NEW_DUEDATE_FORM_FIELD . '_' . $cmid . '_' . 'assign';;
return self::NEW_DUEDATE_FORM_FIELD . '_' . $cmid . '_' . 'assign';
}

/**
Expand Down

0 comments on commit 9aff40d

Please sign in to comment.