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
@@ -437,6 +437,7 @@ func _enqueue_attempt(kind: String, question_id: String, choice_id: String, pres
"presented_choice_ids": presented_choice_ids.duplicate(),
"duration_seconds": maxi(0, duration_seconds),
"met_time_limit": met_time_limit,
"study_session_id": StudySessionService.active_session_id,
"retry_count": 0
})
_save_attempt_queue()
@@ -472,6 +473,11 @@ func _process_attempt_queue() -> void:
"durationSeconds": int(queued.get("duration_seconds", 0)),
"metTimeLimit": bool(queued.get("met_time_limit", true))
})
var study_session_id := str(queued.get("study_session_id", ""))
if not study_session_id.is_empty():
var decoded: Dictionary = JSON.parse_string(body)
decoded["studySessionId"] = study_session_id
body = JSON.stringify(decoded)
if str(queued.get("kind", "answer")) == "skip":
url = "%s/%s/skip" % [question_api_base_url.rstrip("/"), question_id.uri_encode()]
body = ""
@@ -546,6 +552,8 @@ func _apply_first_attempt_response(parsed: Dictionary) -> void:
_update_question_elo(question_id, question_elo)
_apply_rating_change(rating)
CreditsService.apply_award_response(parsed)
# Let Tutor users inspect the final answer before the summary replaces the player.
StudySessionService.apply_response(parsed, true)
choice_percentages_updated.emit(question_id, percentages)
question_rating_updated.emit(question_id, question_elo, rating)