Skip to content

Commit

Permalink
fixes for storing answers after rebase
Browse files Browse the repository at this point in the history
Signed-off-by: Timotheus Pokorra <timotheus.pokorra@solidcharity.com>
  • Loading branch information
tpokorra committed Aug 30, 2023
1 parent abe53ba commit 71f1622
Showing 1 changed file with 4 additions and 7 deletions.
11 changes: 4 additions & 7 deletions lib/Controller/ApiController.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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);
}

Expand Down

0 comments on commit 71f1622

Please sign in to comment.