Constrain CCS patient dialogue

This commit is contained in:
hz
2026-08-06 05:13:21 -05:00
parent 2c7c5dd387
commit dfc224660e
4 changed files with 78 additions and 7 deletions
+24 -5
View File
@@ -54,6 +54,20 @@ func _run() -> void:
await process_frame
_assert(screen.current_view == "case_selection", "CCS Cases 2 should begin with compatible case selection")
_assert(screen.case_list.get_child_count() == 1, "legacy cases should be excluded from graphical selection")
var retired_attempt := {
"caseExternalId": "ccs-gastro-duodenal-ulcer-office-001"
}
_assert(screen._is_retired_interview_revision(retired_attempt, {
"id": "fatigue_course", "patientText": "My stomach bothers me.", "choices": []
}), "the retired stomach response should trigger a current-revision restart")
_assert(screen._is_retired_interview_revision(retired_attempt, {
"id": "chief_concern", "patientText": "Dizzy.",
"choices": [{"id": "abdominal_symptoms", "text": "Ask about stomach pain"}]
}), "retired stomach-topic choices should trigger a current-revision restart")
_assert(not screen._is_retired_interview_revision(retired_attempt, {
"id": "chief_concern", "patientText": "Dizzy and tired.",
"choices": [{"id": "dizziness_character", "text": "Ask about dizziness"}]
}), "the focused dizziness and fatigue revision should remain active")
service.attempt = _sample_attempt(false)
screen._render_state()
@@ -219,11 +233,16 @@ func _choice_labels_fit(scene: Control) -> bool:
return true
func _label_content_fits(label: Label) -> bool:
var font := label.get_theme_font("font")
var font_size := label.get_theme_font_size("font_size")
var content_height := float(label.get_line_count()) * font.get_height(font_size)
return content_height <= label.size.y + 0.5
func _label_content_fits(label: Control) -> bool:
if label is RichTextLabel:
return label.get_content_height() <= label.size.y + 0.5
var plain_label := label as Label
if plain_label == null:
return false
var font := plain_label.get_theme_font("font")
var font_size := plain_label.get_theme_font_size("font_size")
var content_height := float(plain_label.get_line_count()) * font.get_height(font_size)
return content_height <= plain_label.size.y + 0.5
func _assert(condition: bool, message: String) -> void: