Add synced question bookmarks

This commit is contained in:
hz
2026-07-18 23:07:22 -05:00
parent 819a108451
commit 2e52a7ea0a
20 changed files with 1387 additions and 18 deletions
+38
View File
@@ -0,0 +1,38 @@
extends SceneTree
var failures := 0
func _initialize() -> void:
var service = load("res://scripts/autoload/block_session_service.gd").new()
var question := {
"id": "bookmark-test-question",
"system": "Test System",
"choices": [
{"id": "A", "text": "Correct"},
{"id": "B", "text": "Wrong"},
{"id": "C", "text": "Wrong"},
{"id": "D", "text": "Wrong"},
{"id": "E", "text": "Wrong"}
],
"correct_choice_id": "A"
}
_assert(service.start_bookmark_question(question), "bookmark session should start")
_assert(service.session_kind == "bookmark", "bookmark session should have its own kind")
var wrong: Dictionary = service.submit_bookmark_attempt("B", [], false)
_assert(not bool(wrong.get("is_correct", true)), "wrong bookmark attempts should remain retryable")
_assert(service.get_answer_for_index(0) == null, "wrong bookmark attempts should not finalize the question")
var correct: Dictionary = service.submit_bookmark_attempt("A", [], false)
_assert(bool(correct.get("is_correct", false)), "correct bookmark attempt should resolve")
_assert(service.get_answer_for_index(0) != null, "correct bookmark attempt should be retained for review")
var result: Dictionary = service.finish_block()
_assert(result.is_empty(), "bookmark sessions should not calculate progression rewards")
service.free()
quit(1 if failures > 0 else 0)
func _assert(condition: bool, message: String) -> void:
if condition:
return
failures += 1
push_error(message)
+1
View File
@@ -0,0 +1 @@
uid://osdlvlflilgk
+1
View File
@@ -17,6 +17,7 @@ func _initialize() -> void:
_assert(NavigationRoutes.key_for_screen("map") == "study_plan", "study map should activate Study Plan")
_assert(NavigationRoutes.key_for_screen("settings") == "settings", "settings should activate Settings")
_assert(NavigationRoutes.key_for_screen("notes") == "notes", "notes should activate Notes")
_assert(NavigationRoutes.key_for_screen("bookmarks") == "bookmarks", "bookmarks should activate Bookmarks")
quit(1 if failures > 0 else 0)