enhanced submission handling with deccision trees
Some checks failed
PHPUnit / test (push) Has been cancelled

This commit is contained in:
2026-06-05 11:57:28 +02:00
parent 6883654d7c
commit c37940c9a9
4 changed files with 157 additions and 13 deletions

View File

@ -48,6 +48,26 @@ function qdb_decode_multi_check_values(?string $raw): array {
return [$trimmed];
}
/**
* Build glass-scale symptom JSON from the current submit only (no merge with prior rows).
*
* @param array<string, string> $symptomLabels symptom key => selected label
*/
function qdb_build_glass_symptom_json(array $symptomLabels): ?string {
$data = [];
foreach ($symptomLabels as $key => $label) {
$k = trim((string)$key);
$v = trim((string)$label);
if ($k !== '' && $v !== '') {
$data[$k] = $v;
}
}
if ($data === []) {
return null;
}
return json_encode($data, JSON_UNESCAPED_UNICODE);
}
/**
* Group raw POST answer rows by question short id; merge multi_check option keys.
*