Improve question review and image handling

This commit is contained in:
hz
2026-07-14 16:02:14 -05:00
parent 7529ed5863
commit 8aaf7d61e9
8 changed files with 391 additions and 17 deletions
+17
View File
@@ -11,6 +11,7 @@ var question_bank_button: Button
var bank_status_label: Label
var bank_error_label: Label
var retry_button: Button
var image_question_test_link: LinkButton
var current_stage := "exam"
var pending_question_bank_launch := false
@@ -152,6 +153,15 @@ func _build_mode_view() -> void:
retry_button.pressed.connect(_retry_question_bank)
mode_view.add_child(retry_button)
image_question_test_link = LinkButton.new()
image_question_test_link.text = "Temporary: test a question with an image"
image_question_test_link.tooltip_text = "Load a random published question that includes media"
image_question_test_link.size_flags_horizontal = Control.SIZE_SHRINK_BEGIN
image_question_test_link.add_theme_color_override("font_color", Style.CYAN)
image_question_test_link.add_theme_color_override("font_hover_color", Style.MAGENTA)
image_question_test_link.pressed.connect(_select_image_question_for_testing)
mode_view.add_child(image_question_test_link)
var spacer := Control.new()
spacer.size_flags_vertical = Control.SIZE_EXPAND_FILL
mode_view.add_child(spacer)
@@ -196,6 +206,12 @@ func _retry_question_bank() -> void:
_refresh_bank_state()
func _select_image_question_for_testing() -> void:
pending_question_bank_launch = true
QuestionBankService.load_image_question_for_testing()
_refresh_bank_state()
func _on_questions_changed() -> void:
_refresh_bank_state()
if pending_question_bank_launch and visible and current_stage == "step3" and QuestionBankService.load_state == "ready":
@@ -213,6 +229,7 @@ func _refresh_bank_state() -> void:
return
var state := QuestionBankService.load_state
question_bank_button.disabled = pending_question_bank_launch
image_question_test_link.disabled = pending_question_bank_launch
retry_button.visible = state == "failed" or state == "retrying"
retry_button.disabled = state == "retrying"
bank_error_label.text = QuestionBankService.last_error if state == "failed" or state == "retrying" else ""