added prototype dev settings with test import and db wipe
This commit is contained in:
@ -54,7 +54,7 @@ if (!$questionnaire) {
|
||||
}
|
||||
|
||||
// Questions ordered
|
||||
$qStmt = $pdo->prepare("SELECT questionID, defaultText, orderIndex FROM question WHERE questionnaireID = :id ORDER BY orderIndex");
|
||||
$qStmt = $pdo->prepare("SELECT questionID, defaultText, type, orderIndex FROM question WHERE questionnaireID = :id ORDER BY orderIndex");
|
||||
$qStmt->execute([':id' => $qnID]);
|
||||
$questions = $qStmt->fetchAll(PDO::FETCH_ASSOC);
|
||||
$questionIDs = array_column($questions, 'questionID');
|
||||
@ -117,20 +117,8 @@ foreach ($clients as $c) {
|
||||
|
||||
foreach ($questions as $q) {
|
||||
$qid = $q['questionID'];
|
||||
if (isset($answerMap[$qid])) {
|
||||
$a = $answerMap[$qid];
|
||||
if ($a['answerOptionID'] && isset($optionTextMap[$a['answerOptionID']])) {
|
||||
$row[$q['defaultText']] = $optionTextMap[$a['answerOptionID']];
|
||||
} elseif ($a['freeTextValue'] !== null && $a['freeTextValue'] !== '') {
|
||||
$row[$q['defaultText']] = $a['freeTextValue'];
|
||||
} elseif ($a['numericValue'] !== null) {
|
||||
$row[$q['defaultText']] = $a['numericValue'];
|
||||
} else {
|
||||
$row[$q['defaultText']] = '';
|
||||
}
|
||||
} else {
|
||||
$row[$q['defaultText']] = '';
|
||||
}
|
||||
$a = $answerMap[$qid] ?? null;
|
||||
$row[$q['defaultText']] = qdb_format_client_answer_display($q, $a, $optionTextMap);
|
||||
}
|
||||
$rows[] = $row;
|
||||
}
|
||||
|
||||
@ -46,6 +46,8 @@ $routes = [
|
||||
'auth/login' => __DIR__ . '/../handlers/auth.php',
|
||||
'auth/change-password' => __DIR__ . '/../handlers/auth.php',
|
||||
'backup' => __DIR__ . '/../handlers/backup.php',
|
||||
'dev' => __DIR__ . '/../handlers/dev.php',
|
||||
'dev/import' => __DIR__ . '/../handlers/dev.php',
|
||||
'download' => __DIR__ . '/../handlers/download.php',
|
||||
];
|
||||
|
||||
|
||||
Reference in New Issue
Block a user