From 9bcabb016ec578855c384fa7fa1772a1de8655a6 Mon Sep 17 00:00:00 2001 From: Timotheus Pokorra Date: Fri, 5 Jan 2024 17:17:37 +0100 Subject: [PATCH] small fix for ApiController --- lib/Controller/ApiController.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/Controller/ApiController.php b/lib/Controller/ApiController.php index 31b6bc0857..ea43c4fcb9 100644 --- a/lib/Controller/ApiController.php +++ b/lib/Controller/ApiController.php @@ -982,8 +982,8 @@ private function storeAnswersForQuestion($submissionId, array $question, array $ $storedAnswers = $this->answerMapper->findBySubmissionAndQuestion($submissionId, $question['id']); } + // Are we using answer ids as values if (in_array($question['type'], Constants::ANSWER_TYPES_PREDEFINED)) { - $answerText = ""; $newAnswerTexts = array(); @@ -996,7 +996,7 @@ private function storeAnswersForQuestion($submissionId, array $question, array $ $optionIndex = array_search($answer, array_column($question['options'], 'id')); if ($optionIndex !== false) { $answerText = $question['options'][$optionIndex]['text']; - } elseif (!empty($question['extraSettings']->allowOtherAnswer) && strpos($answer, Constants::QUESTION_EXTRASETTINGS_OTHER_PREFIX) === 0) { + } elseif (!empty($question['extraSettings']['allowOtherAnswer']) && strpos($answer, Constants::QUESTION_EXTRASETTINGS_OTHER_PREFIX) === 0) { $answerText = str_replace(Constants::QUESTION_EXTRASETTINGS_OTHER_PREFIX, "", $answer); }