Fix simulation preview feedback
This commit is contained in:
@@ -132,7 +132,13 @@ func _on_request_completed(result: int, response_code: int, _headers: PackedStri
|
|||||||
is_loading = false
|
is_loading = false
|
||||||
call_deferred("_process_request_queue")
|
call_deferred("_process_request_queue")
|
||||||
if result != HTTPRequest.RESULT_SUCCESS or response_code < 200 or response_code >= 300:
|
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
|
return
|
||||||
if response_code == 204:
|
if response_code == 204:
|
||||||
if action == "active" or action == "abandon":
|
if action == "active" or action == "abandon":
|
||||||
|
|||||||
@@ -72,10 +72,10 @@ func _refresh() -> void:
|
|||||||
var break_seconds := int(ExamSimulationService.simulation.get("breakSecondsRemaining", 3300))
|
var break_seconds := int(ExamSimulationService.simulation.get("breakSecondsRemaining", 3300))
|
||||||
if block < 0:
|
if block < 0:
|
||||||
title.text = "Foundations of Independent Practice"
|
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:
|
else:
|
||||||
title.text = "Block %d complete" % (block + 1)
|
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.text = "Start Block %d" % (block + 2)
|
||||||
start_button.disabled = ExamSimulationService.is_loading
|
start_button.disabled = ExamSimulationService.is_loading
|
||||||
abandon_button.text = "Confirm abandon" if abandon_armed else "Abandon simulation"
|
abandon_button.text = "Confirm abandon" if abandon_armed else "Abandon simulation"
|
||||||
|
|||||||
@@ -260,6 +260,7 @@ func _select_simulation() -> void:
|
|||||||
func _preview_simulation_results() -> void:
|
func _preview_simulation_results() -> void:
|
||||||
pending_simulation_launch = true
|
pending_simulation_launch = true
|
||||||
simulation_preview_link.disabled = true
|
simulation_preview_link.disabled = true
|
||||||
|
simulation_status_label.text = "Generating simulated exam results..."
|
||||||
ExamSimulationService.load_results_preview()
|
ExamSimulationService.load_results_preview()
|
||||||
|
|
||||||
|
|
||||||
@@ -294,11 +295,11 @@ func _launch_simulation_block() -> void:
|
|||||||
|
|
||||||
func _on_simulation_failed(message: String) -> void:
|
func _on_simulation_failed(message: String) -> void:
|
||||||
pending_simulation_launch = false
|
pending_simulation_launch = false
|
||||||
|
_refresh_simulation_state()
|
||||||
if simulation_preview_link != null:
|
if simulation_preview_link != null:
|
||||||
simulation_preview_link.disabled = false
|
simulation_preview_link.disabled = false
|
||||||
if simulation_status_label != null:
|
if simulation_status_label != null:
|
||||||
simulation_status_label.text = message
|
simulation_status_label.text = message
|
||||||
_refresh_simulation_state()
|
|
||||||
|
|
||||||
|
|
||||||
func _refresh_simulation_state() -> void:
|
func _refresh_simulation_state() -> void:
|
||||||
@@ -330,7 +331,7 @@ func _refresh_bank_state() -> void:
|
|||||||
elif state == "failed":
|
elif state == "failed":
|
||||||
bank_status_label.text = "The question bank could not be loaded."
|
bank_status_label.text = "The question bank could not be loaded."
|
||||||
else:
|
else:
|
||||||
bank_status_label.text = "Question bank will load when selected."
|
bank_status_label.text = ""
|
||||||
|
|
||||||
|
|
||||||
func _start_question_bank() -> void:
|
func _start_question_bank() -> void:
|
||||||
|
|||||||
Reference in New Issue
Block a user