enhanced submission handling with deccision trees
Some checks failed
PHPUnit / test (push) Has been cancelled
Some checks failed
PHPUnit / test (push) Has been cancelled
This commit is contained in:
@ -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.
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user