diff --git a/lib/Controller/ApiController.php b/lib/Controller/ApiController.php index 84870f1ca..eeacf84ca 100644 --- a/lib/Controller/ApiController.php +++ b/lib/Controller/ApiController.php @@ -942,10 +942,7 @@ private function storeAnswersForQuestion($submissionId, array $question, array $ $answerText = str_replace(Constants::QUESTION_EXTRASETTINGS_OTHER_PREFIX, "", $answer); } - // Load option-text - $answerText = $option['text']; - - $newAnswersText[] = $answerText; + $newAnswerTexts[] = $answerText; // has this answer already been stored? $foundAnswer = false; @@ -1106,7 +1103,7 @@ public function updateSubmission(int $formId, array $answers, string $shareHash if ($questionIndex === false) { continue; } - + $question = $questions[$questionIndex]; $this->storeAnswersForQuestion($submission->getId(), $question, $answerArray, true); @@ -1178,10 +1175,10 @@ public function insertSubmission(int $formId, array $answers, string $shareHash $questionIndex = array_search($questionId, array_column($questions, 'id')); if ($questionIndex === false) { continue; - } else { - $question = $questions[$questionIndex]; } + $question = $questions[$questionIndex]; + $this->storeAnswersForQuestion($submission->getId(), $question, $answerArray, false); }