FHM09062601IBL - simpan T_ScreeningAnswerValue sebagai JSON object bukan string

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
sas.fajri
2026-06-11 09:46:36 +07:00
parent 655757599a
commit 67bb072e0d

View File

@@ -530,8 +530,13 @@ class Screening extends MY_Controller
$form_id = intval($item['M_ScreeningFormID'] ?? 0);
if (!$form_id) continue;
// Simpan label sebagai JSON string agar json_decode di search() bekerja
$stored_value = json_encode($item['answer_label'] ?? '');
// Simpan sebagai JSON object
$answer_type = $item['answer_type'] ?? 'single';
if ($answer_type === 'text') {
$stored_value = json_encode(['value' => $item['answer_label'] ?? '']);
} else {
$stored_value = json_encode(['id' => $item['answer_id'] ?? '', 'label' => $item['answer_label'] ?? '']);
}
$this->db_oneklinik->query(
"INSERT INTO one_klinik.t_screening_answer