diff --git a/scripts/ui/ccs_cases_2_screen.gd b/scripts/ui/ccs_cases_2_screen.gd index 5cb22f5..549d628 100644 --- a/scripts/ui/ccs_cases_2_screen.gd +++ b/scripts/ui/ccs_cases_2_screen.gd @@ -93,9 +93,22 @@ func _on_attempt_changed() -> void: var completed_exam_code := pending_exam_code pending_action = "" pending_exam_code = "" + if completed_action == "physical_exam" and active_scene != null \ + and current_view == "doctor_office": + _refresh_exam_result(CCSService.attempt, completed_exam_code) + return _render_state() - if completed_action == "physical_exam" and active_scene != null: - active_scene.show_exam_result(CCSService.attempt.get("chart", []), completed_exam_code) + + +func _refresh_exam_result(attempt: Dictionary, exam_code: String) -> void: + active_scene.configure_presentation( + attempt.get("graphicalPresentation", {}), + str(attempt.get("simulatedStartUtc", "")), + int(attempt.get("simulatedMinute", 0)), + attempt.get("vitals", {}), + str(attempt.get("medicalHistory", "")), attempt.get("chart", [])) + active_scene.configure_examinations(attempt.get("availableExams", []), attempt.get("chart", [])) + active_scene.show_exam_result(attempt.get("chart", []), exam_code) func _render_state() -> void: diff --git a/tests/ccs_cases_2_ui_test.gd b/tests/ccs_cases_2_ui_test.gd index 13d8e21..28746e1 100644 --- a/tests/ccs_cases_2_ui_test.gd +++ b/tests/ccs_cases_2_ui_test.gd @@ -236,6 +236,7 @@ func _run() -> void: screen._on_attempt_changed() await process_frame _assert(screen.current_view == "doctor_office", "attempt refreshes should preserve the interview phase") + _assert(not screen.active_scene.is_patient_dialogue_visible(), "an examination result should not replay the current patient dialogue") _assert(screen.active_scene.physical_exam_finding_text.text == "Mild epigastric tenderness.", "the returned chart finding should be displayed") _assert(screen.active_scene.physical_exam_result_button.visible, "a completed exam should present a focused result card") var result_dialogue_page: int = screen.active_scene.dialogue_page_index