Skip to content

Commit

Permalink
Test: Fix AutoCompleteLength Might Be Null
Browse files Browse the repository at this point in the history
  • Loading branch information
kergomard committed Jan 3, 2025
1 parent c3d4645 commit a1fab3f
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 15 deletions.
24 changes: 12 additions & 12 deletions components/ILIAS/TestQuestionPool/classes/class.assLongMenu.php
Original file line number Diff line number Diff line change
Expand Up @@ -133,14 +133,14 @@ public function getSpecificFeedbackSetting(): int
return $this->specificFeedbackSetting;
}

public function setMinAutoComplete($minAutoComplete): void
public function setMinAutoComplete(int $min_auto_complete): void
{
$this->minAutoComplete = $minAutoComplete;
$this->minAutoComplete = $min_auto_complete;
}

public function getMinAutoComplete(): int
{
return $this->minAutoComplete ? $this->minAutoComplete : self::MIN_LENGTH_AUTOCOMPLETE;
return $this->minAutoComplete;
}

public function isComplete(): bool
Expand Down Expand Up @@ -367,19 +367,19 @@ public function loadFromDb($question_id): void
if ($result->numRows() == 1) {
$data = $this->db->fetchAssoc($result);
$this->setId($question_id);
$this->setObjId($data["obj_fi"]);
$this->setObjId($data['obj_fi']);
$this->setNrOfTries($data['nr_of_tries']);
$this->setTitle((string) $data["title"]);
$this->setComment((string) $data["description"]);
$this->setOriginalId($data["original_id"]);
$this->setAuthor($data["author"]);
$this->setPoints($data["points"]);
$this->setIdenticalScoring((bool) $data["identical_scoring"]);
$this->setOwner($data["owner"]);
$this->setTitle((string) $data['title']);
$this->setComment((string) $data['description']);
$this->setOriginalId($data['original_id']);
$this->setAuthor($data['author']);
$this->setPoints($data['points']);
$this->setIdenticalScoring((bool) $data['identical_scoring']);
$this->setOwner($data['owner']);
$this->setQuestion(ilRTE::_replaceMediaObjectImageSrc((string) $data['question_text'], 1));
$this->setLongMenuTextValue(ilRTE::_replaceMediaObjectImageSrc((string) $data['long_menu_text'], 1));
$this->loadCorrectAnswerData($question_id);
$this->setMinAutoComplete($data["min_auto_complete"]);
$this->setMinAutoComplete($data['min_auto_complete'] ?? self::MIN_LENGTH_AUTOCOMPLETE);
if (isset($data['feedback_setting'])) {
$this->setSpecificFeedbackSetting((int) $data['feedback_setting']);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ protected function writePostData(bool $always = false): int

public function writeQuestionSpecificPostData(ilPropertyFormGUI $form): void
{
$min_auto_complete = (int) $form->getInput('min_auto_complete');
$min_auto_complete = (int) ($form->getInput('min_auto_complete') ?? assLongMenu::MIN_LENGTH_AUTOCOMPLETE);
$hidden_text_files = $this->request_data_collector->string('hidden_text_files');
$hidden_correct_answers = $this->request_data_collector->string('hidden_correct_answers');
$long_menu_type = $this->request_data_collector->raw('long_menu_type') ?? [];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -199,8 +199,8 @@ public function fromXML(
$this->object->setAuthor($item->getAuthor());
$this->object->setOwner($user_id);
$this->object->setObjId($questionpool_id);
$this->object->setMinAutoComplete((int) $item->getMetadataEntry("minAutoCompleteLength"));
$this->object->setIdenticalscoring((int) $item->getMetadataEntry("identical_scoring"));
$this->object->setMinAutoComplete((int) ($item->getMetadataEntry('minAutoCompleteLength') ?? assLongMenu::MIN_LENGTH_AUTOCOMPLETE));
$this->object->setIdenticalscoring((int) $item->getMetadataEntry('identical_scoring'));
$this->object->setCorrectAnswers($correct_answers);
$this->object->setPoints($sum);
// additional content editing mode information
Expand Down

0 comments on commit a1fab3f

Please sign in to comment.