Add CCS study tools and case reporting

This commit is contained in:
hz
2026-07-15 10:43:03 -05:00
parent 7256f93002
commit 9f379cda5c
13 changed files with 542 additions and 56 deletions
+49 -4
View File
@@ -14,7 +14,10 @@ var retry_button: Button
var simulation_button: Button
var simulation_status_label: Label
var simulation_preview_link: LinkButton
var ccs_button: Button
var ccs_status_label: Label
var pending_simulation_launch := false
var pending_ccs_launch := false
var current_stage := "exam"
var pending_question_bank_launch := false
@@ -35,6 +38,10 @@ func _ready() -> void:
ExamSimulationService.request_failed.connect(_on_simulation_failed)
if not AuthState.auth_changed.is_connected(_refresh_simulation_preview_visibility):
AuthState.auth_changed.connect(_refresh_simulation_preview_visibility)
if not CCSService.attempt_changed.is_connected(_on_ccs_attempt_changed):
CCSService.attempt_changed.connect(_on_ccs_attempt_changed)
if not CCSService.request_failed.is_connected(_on_ccs_failed):
CCSService.request_failed.connect(_on_ccs_failed)
_build_exam_view()
_build_mode_view()
@@ -53,6 +60,7 @@ func on_show(payload: Variant = null) -> void:
func on_hide() -> void:
pending_question_bank_launch = false
pending_ccs_launch = false
func _build_exam_view() -> void:
@@ -88,7 +96,6 @@ func _build_exam_view() -> void:
_add_exam_option("STEP 1", "Foundational sciences", false)
_add_exam_option("STEP 2", "Clinical knowledge", false)
_add_exam_option("STEP 3", "Advanced clinical management", true)
_add_exam_option("CCS Cases", "Interactive case simulations", true, "ccs")
func _build_mode_view() -> void:
@@ -159,6 +166,21 @@ func _build_mode_view() -> void:
simulation_button.pressed.connect(_select_simulation)
mode_grid.add_child(simulation_button)
ccs_button = Button.new()
ccs_button.text = "CCS Cases\nInteractive case simulations | Available"
ccs_button.alignment = HORIZONTAL_ALIGNMENT_LEFT
ccs_button.custom_minimum_size = Vector2(360, 150)
ccs_button.size_flags_horizontal = Control.SIZE_EXPAND_FILL
ccs_button.add_theme_font_size_override("font_size", 20)
Style.style_primary_button(ccs_button)
ccs_button.pressed.connect(_select_ccs)
mode_grid.add_child(ccs_button)
ccs_status_label = Label.new()
ccs_status_label.autowrap_mode = TextServer.AUTOWRAP_WORD_SMART
Style.set_label(ccs_status_label, 15, Style.MUTED)
mode_view.add_child(ccs_status_label)
simulation_status_label = Label.new()
simulation_status_label.autowrap_mode = TextServer.AUTOWRAP_WORD_SMART
Style.set_label(simulation_status_label, 15, Style.MUTED)
@@ -197,7 +219,7 @@ func _build_mode_view() -> void:
mode_view.add_child(spacer)
func _add_exam_option(option_name: String, description: String, available: bool, destination: String = "step3") -> void:
func _add_exam_option(option_name: String, description: String, available: bool) -> void:
var button := Button.new()
button.text = "%s\n%s | %s" % [option_name, description, "Available" if available else "Coming Soon"]
button.alignment = HORIZONTAL_ALIGNMENT_LEFT
@@ -208,8 +230,7 @@ func _add_exam_option(option_name: String, description: String, available: bool,
button.disabled = not available
if available:
Style.style_primary_button(button)
if destination == "ccs": button.pressed.connect(func(): main.show_screen("ccs_hub"))
else: button.pressed.connect(func(): _show_stage("step3"))
button.pressed.connect(func(): _show_stage("step3"))
exam_grid.add_child(button)
@@ -231,6 +252,30 @@ func _select_question_bank() -> void:
_refresh_bank_state()
func _select_ccs() -> void:
pending_ccs_launch = true
ccs_button.disabled = true
ccs_status_label.text = "Selecting a timed case..."
CCSService.create_attempt("", "timed")
func _on_ccs_attempt_changed() -> void:
if not pending_ccs_launch or CCSService.attempt.is_empty():
return
pending_ccs_launch = false
ccs_button.disabled = false
ccs_status_label.text = ""
main.show_screen("ccs_player")
func _on_ccs_failed(message: String) -> void:
if not pending_ccs_launch:
return
pending_ccs_launch = false
ccs_button.disabled = false
ccs_status_label.text = message
func _retry_question_bank() -> void:
pending_question_bank_launch = true
QuestionBankService.retry_now()