Revert "refactored export functionality"

This reverts commit 2616238dc8.
This commit is contained in:
2026-05-22 14:23:39 +02:00
parent 2616238dc8
commit e0be2c501f
6 changed files with 157 additions and 206 deletions

View File

@ -1,7 +1,5 @@
<?php
require_once __DIR__ . '/../lib/questionnaire_reachability.php';
$tokenRec = require_valid_token();
if ($method !== 'GET') {
@ -33,15 +31,6 @@ $qStmt->execute([':id' => $qnID]);
$questions = $qStmt->fetchAll(PDO::FETCH_ASSOC);
$questionIDs = array_column($questions, 'questionID');
$optionTextMap = [];
foreach ($questionIDs as $qid) {
$aoStmt = $pdo->prepare("SELECT answerOptionID, defaultText FROM answer_option WHERE questionID = :qid");
$aoStmt->execute([':qid' => $qid]);
foreach ($aoStmt->fetchAll(PDO::FETCH_ASSOC) as $ao) {
$optionTextMap[$ao['answerOptionID']] = $ao['defaultText'];
}
}
foreach ($questions as &$q) {
$q['isRequired'] = (int)$q['isRequired'];
$q['orderIndex'] = (int)$q['orderIndex'];
@ -106,14 +95,7 @@ if (!empty($questionIDs) && !empty($clients)) {
'answeredAt' => $a['answeredAt'] !== null ? (int)$a['answeredAt'] : null,
];
}
$reachable = qrb_reachable_question_ids($pdo, $qnID, $answerMap, $optionTextMap);
$filtered = [];
foreach ($answerMap as $qid => $ans) {
if (isset($reachable[$qid])) {
$filtered[$qid] = $ans;
}
}
$c['answers'] = $filtered;
$c['answers'] = $answerMap;
}
unset($c);
} else {