Fix simulation preview feedback

This commit is contained in:
hz
2026-07-14 17:27:58 -05:00
parent bbb373acf4
commit 3e39a4ffce
3 changed files with 12 additions and 5 deletions
+7 -1
View File
@@ -132,7 +132,13 @@ func _on_request_completed(result: int, response_code: int, _headers: PackedStri
is_loading = false
call_deferred("_process_request_queue")
if result != HTTPRequest.RESULT_SUCCESS or response_code < 200 or response_code >= 300:
request_failed.emit("Simulation request failed with status %d." % response_code)
var server_message := body.get_string_from_utf8().strip_edges()
if server_message.length() > 240:
server_message = server_message.left(240)
var message := "Simulation request failed with status %d." % response_code
if not server_message.is_empty():
message = "%s %s" % [message, server_message]
request_failed.emit(message)
return
if response_code == 204:
if action == "active" or action == "abandon":
+2 -2
View File
@@ -72,10 +72,10 @@ func _refresh() -> void:
var break_seconds := int(ExamSimulationService.simulation.get("breakSecondsRemaining", 3300))
if block < 0:
title.text = "Foundations of Independent Practice"
detail.text = "232 questions across 12 timed blocks. Results and explanations remain hidden until the simulation is complete. Estimated break pool: %d minutes." % int(break_seconds / 60)
detail.text = "232 questions across 12 timed blocks. Results and explanations remain hidden until the simulation is complete. Estimated break pool: %d minutes." % int(break_seconds / 60.0)
else:
title.text = "Block %d complete" % (block + 1)
detail.text = "%d of 12 blocks complete. Your progress is saved. Break pool: approximately %d minutes." % [block + 1, int(break_seconds / 60)]
detail.text = "%d of 12 blocks complete. Your progress is saved. Break pool: approximately %d minutes." % [block + 1, int(break_seconds / 60.0)]
start_button.text = "Start Block %d" % (block + 2)
start_button.disabled = ExamSimulationService.is_loading
abandon_button.text = "Confirm abandon" if abandon_armed else "Abandon simulation"
+3 -2
View File
@@ -260,6 +260,7 @@ func _select_simulation() -> void:
func _preview_simulation_results() -> void:
pending_simulation_launch = true
simulation_preview_link.disabled = true
simulation_status_label.text = "Generating simulated exam results..."
ExamSimulationService.load_results_preview()
@@ -294,11 +295,11 @@ func _launch_simulation_block() -> void:
func _on_simulation_failed(message: String) -> void:
pending_simulation_launch = false
_refresh_simulation_state()
if simulation_preview_link != null:
simulation_preview_link.disabled = false
if simulation_status_label != null:
simulation_status_label.text = message
_refresh_simulation_state()
func _refresh_simulation_state() -> void:
@@ -330,7 +331,7 @@ func _refresh_bank_state() -> void:
elif state == "failed":
bank_status_label.text = "The question bank could not be loaded."
else:
bank_status_label.text = "Question bank will load when selected."
bank_status_label.text = ""
func _start_question_bank() -> void: