removing last page from being stored
Some checks failed
PHPUnit / test (push) Has been cancelled

This commit is contained in:
2026-07-01 09:33:44 +02:00
parent bbf10fe866
commit 70dca17451
5 changed files with 29 additions and 0 deletions

View File

@ -1069,6 +1069,14 @@ function qdb_glass_symptom_answer_value(?string $json, string $symptomKey): stri
return trim((string)($decoded[$symptomKey] ?? '')); return trim((string)($decoded[$symptomKey] ?? ''));
} }
/**
* Question types that exist only for app/editor flow (no answer payload to persist).
*/
function qdb_is_non_stored_answer_question_type(string $type): bool
{
return $type === 'last_page';
}
/** /**
* Flat columns for results / CSV: one column per glass-scale symptom. * Flat columns for results / CSV: one column per glass-scale symptom.
* *
@ -1080,6 +1088,9 @@ function qdb_results_export_columns(array $questions, string $qnID): array
foreach ($questions as $q) { foreach ($questions as $q) {
$cfg = json_decode($q['configJson'] ?? '{}', true) ?: []; $cfg = json_decode($q['configJson'] ?? '{}', true) ?: [];
$type = $q['type'] ?? ''; $type = $q['type'] ?? '';
if (qdb_is_non_stored_answer_question_type($type)) {
continue;
}
if ($type === 'glass_scale_question') { if ($type === 'glass_scale_question') {
$symptoms = $cfg['symptoms'] ?? []; $symptoms = $cfg['symptoms'] ?? [];
if (is_array($symptoms) && $symptoms !== []) { if (is_array($symptoms) && $symptoms !== []) {
@ -1368,6 +1379,9 @@ function qdb_display_questionnaire_context(PDO $pdo, string $questionnaireID): a
foreach ($questions as $q) { foreach ($questions as $q) {
$cfg = json_decode($q['configJson'] ?? '{}', true) ?: []; $cfg = json_decode($q['configJson'] ?? '{}', true) ?: [];
$type = $q['type'] ?? ''; $type = $q['type'] ?? '';
if (qdb_is_non_stored_answer_question_type($type)) {
continue;
}
if ($type === 'glass_scale_question') { if ($type === 'glass_scale_question') {
$symptoms = $cfg['symptoms'] ?? []; $symptoms = $cfg['symptoms'] ?? [];
if (is_array($symptoms) && $symptoms !== []) { if (is_array($symptoms) && $symptoms !== []) {

View File

@ -228,6 +228,12 @@ if ($method === 'POST') {
continue; continue;
} }
$qType = $shortIdToType[$shortId] ?? '';
if (qdb_is_non_stored_answer_question_type($qType)) {
$answerDelete->execute([':cc' => $clientCode, ':qid' => $fullQID]);
continue;
}
$answerOptionID = null; $answerOptionID = null;
$freeTextValue = isset($a['freeTextValue']) ? (string)$a['freeTextValue'] : null; $freeTextValue = isset($a['freeTextValue']) ? (string)$a['freeTextValue'] : null;
$numericValue = isset($a['numericValue']) ? (float)$a['numericValue'] : null; $numericValue = isset($a['numericValue']) ? (float)$a['numericValue'] : null;

View File

@ -69,6 +69,11 @@ function qdb_validate_app_submit_payload(
continue; continue;
} }
$type = $shortIdToType[$shortId] ?? '';
if (qdb_is_non_stored_answer_question_type($type)) {
continue;
}
$fullQID = $shortIdMap[$shortId]; $fullQID = $shortIdMap[$shortId];
$type = $shortIdToType[$shortId] ?? ''; $type = $shortIdToType[$shortId] ?? '';
$optKey = $a['answerOptionKey'] ?? null; $optKey = $a['answerOptionKey'] ?? null;

View File

@ -47,6 +47,9 @@ function qdb_display_context_from_manifest(PDO $pdo, array $manifest): array {
$cfg = json_decode($qRow['configJson'] ?? '{}', true) ?: []; $cfg = json_decode($qRow['configJson'] ?? '{}', true) ?: [];
$type = $qRow['type'] ?? ''; $type = $qRow['type'] ?? '';
if (qdb_is_non_stored_answer_question_type($type)) {
continue;
}
if ($type === 'glass_scale_question') { if ($type === 'glass_scale_question') {
$symptoms = $cfg['symptoms'] ?? $qEntry['symptoms'] ?? []; $symptoms = $cfg['symptoms'] ?? $qEntry['symptoms'] ?? [];
if (is_array($symptoms) && $symptoms !== []) { if (is_array($symptoms) && $symptoms !== []) {

View File

@ -62,6 +62,7 @@ export function glassSymptomAnswerValue(raw, symptomKey) {
export function buildResultColumns(questions) { export function buildResultColumns(questions) {
const cols = []; const cols = [];
for (const q of questions || []) { for (const q of questions || []) {
if (q.type === 'last_page') continue;
const cfg = parseQuestionConfig(q); const cfg = parseQuestionConfig(q);
const symptoms = cfg.symptoms; const symptoms = cfg.symptoms;
if (q.type === 'glass_scale_question' && Array.isArray(symptoms) && symptoms.length > 0) { if (q.type === 'glass_scale_question' && Array.isArray(symptoms) && symptoms.length > 0) {