Add study session goals and summaries

This commit is contained in:
hz
2026-08-01 02:34:58 -05:00
parent ddc36a8048
commit 2bd2628009
27 changed files with 926 additions and 21 deletions
+15 -2
View File
@@ -1224,13 +1224,16 @@ func _process(delta: float) -> void:
return
if visible and BlockSessionService.block_started and BlockSessionService.session_kind == "core":
_update_timer_bar()
if visible and BlockSessionService.block_started and BlockSessionService.mode == "Timed" and (report_overlay == null or not report_overlay.visible):
var duration_goal := str(StudySessionService.progress.get("goalType", "")) == "duration"
if visible and BlockSessionService.block_started and (BlockSessionService.mode == "Timed" or duration_goal) and (report_overlay == null or not report_overlay.visible):
BlockSessionService.seconds_remaining = max(0.0, BlockSessionService.seconds_remaining - delta)
var shown_seconds := int(ceil(BlockSessionService.seconds_remaining))
_set_timer_display(shown_seconds)
_update_timer_bar()
if BlockSessionService.seconds_remaining <= 0:
if BlockSessionService.seconds_remaining <= 0 and not duration_goal:
_finish()
elif BlockSessionService.seconds_remaining <= 0 and duration_goal:
timer_label.text = "Finish current question"
if visible and not _is_session_timer_visible() and (report_overlay == null or not report_overlay.visible):
# No real time limit applies here - show a simple local count-up stopwatch
# ("Time elapsed") so the bottom-bar time slot is never blank, without
@@ -2081,6 +2084,12 @@ func _open_reference_url(url: String) -> void:
func _advance_or_finish() -> void:
if not StudySessionService.summary.is_empty():
StudySessionService.emit_deferred_summary()
return
if str(StudySessionService.progress.get("goalType", "")) == "duration" and BlockSessionService.seconds_remaining <= 0:
StudySessionService.check_completion()
return
if BlockSessionService.move_next():
_load_question()
else:
@@ -2105,6 +2114,8 @@ func _finish() -> void:
func _exit_run() -> void:
if StudySessionService.is_active() and BlockSessionService.session_kind != "simulation":
StudySessionService.finish_early()
if BlockSessionService.session_kind == "bookmark":
BlockSessionService.finish_block()
main.show_screen("bookmarks")
@@ -2157,6 +2168,8 @@ func _set_timer_display(total_seconds: int) -> void:
func _is_session_timer_visible() -> bool:
if BlockSessionService.session_kind == "core" or BlockSessionService.session_kind == "simulation":
return true
if str(StudySessionService.progress.get("goalType", "")) == "duration":
return true
return BlockSessionService.mode == "Timed"