Skip to content

Commit

Permalink
Deal with maxword and minword limits
Browse files Browse the repository at this point in the history
  • Loading branch information
marcusgreen committed Apr 3, 2024
1 parent b82aee9 commit cb28e2f
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions questiontype.php
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,7 @@ public function save_question_options($formdata) {
$options->responsefieldlines = $formdata->responsefieldlines;
$options->minwordlimit = isset($formdata->minwordenabled) ? $formdata->minwordlimit : null;
$options->maxwordlimit = isset($formdata->maxwordenabled) ? $formdata->maxwordlimit : null;

$options->maxbytes = $formdata->maxbytes ?? 0;
if (is_array($formdata->graderinfo)) {
// Today find out what it should save and ensure it is available as text not arrays.
Expand Down Expand Up @@ -285,6 +286,12 @@ public function import_from_xml($data, $question, qformat_xml $format, $extra=nu
$fmt = $format->get_format($format->getpath($data, array('#', $field.'format', 0, '#'), 0));
$qo->$field = $format->import_text_with_files($data, array('#', $field, 0), '', $fmt);
}
if (isset($qo->maxwordlimit) && $qo->maxwordlimit > "") {
$qo->maxwordenabled = true;
}
if (isset($qo->minwordlimit) && $qo->minwordlimit > "") {
$qo->minwordenabled = true;
}

$extraanswersfields = $this->extra_answer_fields();
if (is_array($extraanswersfields)) {
Expand Down

0 comments on commit cb28e2f

Please sign in to comment.