Lock submitted simulation answers

This commit is contained in:
hz
2026-07-30 16:54:12 -05:00
parent 9709bab9a9
commit 5488dec2c7
8 changed files with 142 additions and 10 deletions
+14
View File
@@ -426,6 +426,20 @@ func _test_player_runtime_construction() -> void:
_assert(player.choice_buttons[0].size.x <= player.question_panel.size.x, "long answer choices should not widen the question player")
_assert(player.next_button.get_global_rect().end.x <= player.get_global_rect().end.x + 0.5, "long answer choices should never push Submit beyond the viewport")
var prior_session_kind: String = root.get_node("BlockSessionService").session_kind
_assert(root.get_node("BlockSessionService")._simulation_response_is_submitted({"choiceId": "A", "isSubmitted": null}), "legacy answered simulation responses should restore as submitted")
_assert(not root.get_node("BlockSessionService")._simulation_response_is_submitted({"choiceId": "A", "isSubmitted": false}), "new simulation drafts should remain editable after an in-session autosave")
_assert(not root.get_node("BlockSessionService")._simulation_response_is_submitted({"choiceId": "", "isSubmitted": null}), "legacy skipped simulation responses should remain revisitable")
root.get_node("BlockSessionService").session_kind = "simulation"
player.presented_choices = [{"id": "A", "text": "First"}, {"id": "B", "text": "Second"}]
player.current_answer = {"selected_choice_id": "A", "is_submitted": true}
player.selected_choice = "A"
player._apply_saved_choice_state()
_assert(player.choice_buttons[0].disabled and player.choice_buttons[1].disabled, "resumed submitted simulation answers should lock every choice")
_assert(not player.next_button.disabled, "a resumed submitted answer should still allow navigation to the next question")
player._select_choice(1)
_assert(player.selected_choice == "A", "a resumed submitted simulation answer should not be changeable")
player.current_answer = {}
player.selected_choice = ""
for session_kind in ["block", "core", "bookmark", "review", "simulation"]:
root.get_node("BlockSessionService").session_kind = session_kind
player._refresh_toolbar_state()