Move simulation history into profile
This commit is contained in:
@@ -12,6 +12,8 @@ var outcome_consent: CheckBox
|
||||
var outcome_status: Label
|
||||
var outcome_delete_button: Button
|
||||
var current_simulation := {}
|
||||
var return_screen := "selection"
|
||||
var done_button: Button
|
||||
|
||||
|
||||
func _ready() -> void:
|
||||
@@ -47,7 +49,7 @@ func _ready() -> void:
|
||||
review_button.custom_minimum_size = Vector2(240, 50)
|
||||
review_button.size_flags_horizontal = Control.SIZE_SHRINK_BEGIN
|
||||
Style.style_primary_button(review_button)
|
||||
review_button.pressed.connect(func(): main.show_screen("simulation_review", current_simulation))
|
||||
review_button.pressed.connect(func(): main.show_screen("simulation_review", {"simulation": current_simulation, "return_screen": return_screen}))
|
||||
content.add_child(review_button)
|
||||
|
||||
var outcome_heading := Label.new()
|
||||
@@ -91,17 +93,20 @@ func _ready() -> void:
|
||||
if not ExamSimulationService.outcome_changed.is_connected(_refresh_outcome):
|
||||
ExamSimulationService.outcome_changed.connect(_refresh_outcome)
|
||||
|
||||
var done := Button.new()
|
||||
done.text = "Return to study modes"
|
||||
done.custom_minimum_size = Vector2(240, 50)
|
||||
done.size_flags_horizontal = Control.SIZE_SHRINK_BEGIN
|
||||
Style.style_primary_button(done)
|
||||
done.pressed.connect(func(): main.show_screen("selection", "step3"))
|
||||
add_child(done)
|
||||
done_button = Button.new()
|
||||
done_button.text = "Return to study modes"
|
||||
done_button.custom_minimum_size = Vector2(240, 50)
|
||||
done_button.size_flags_horizontal = Control.SIZE_SHRINK_BEGIN
|
||||
Style.style_primary_button(done_button)
|
||||
done_button.pressed.connect(_return_from_results)
|
||||
add_child(done_button)
|
||||
|
||||
|
||||
func on_show(payload: Variant = null) -> void:
|
||||
var simulation: Dictionary = payload if typeof(payload) == TYPE_DICTIONARY else ExamSimulationService.simulation
|
||||
var wrapper: Dictionary = payload if typeof(payload) == TYPE_DICTIONARY else {}
|
||||
var simulation: Dictionary = wrapper.get("simulation", wrapper) if not wrapper.is_empty() else ExamSimulationService.simulation
|
||||
return_screen = str(wrapper.get("return_screen", "selection"))
|
||||
done_button.text = "Return to simulation history" if return_screen == "simulation_history" else "Return to study modes"
|
||||
current_simulation = simulation
|
||||
var score: Dictionary = simulation.get("score", {})
|
||||
var predicted := int(score.get("predictedScore", 0))
|
||||
@@ -121,6 +126,13 @@ func on_show(payload: Variant = null) -> void:
|
||||
ExamSimulationService.load_outcome()
|
||||
|
||||
|
||||
func _return_from_results() -> void:
|
||||
if return_screen == "simulation_history":
|
||||
main.show_screen("simulation_history", "preserve")
|
||||
else:
|
||||
main.show_screen("selection", "step3")
|
||||
|
||||
|
||||
func _clear(container: Control) -> void:
|
||||
for child in container.get_children():
|
||||
child.queue_free()
|
||||
|
||||
Reference in New Issue
Block a user