From 71f1622e14a403af5eaa9ae1adeaee5a2e292568 Mon Sep 17 00:00:00 2001 From: Timotheus Pokorra Date: Wed, 30 Aug 2023 11:56:26 +0200 Subject: [PATCH] fixes for storing answers after rebase Signed-off-by: Timotheus Pokorra --- lib/Controller/ApiController.php | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) 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); }