Add user progress dashboard

This commit is contained in:
hz
2026-07-18 23:45:38 -05:00
parent 2e52a7ea0a
commit 2dcac51452
26 changed files with 983 additions and 17 deletions
+6 -4
View File
@@ -257,10 +257,10 @@ func clear_questions() -> void:
ratings_changed.emit()
func record_first_attempt(question_id: String, choice_id: String, presented_choice_ids: Array = []) -> void:
func record_first_attempt(question_id: String, choice_id: String, presented_choice_ids: Array = [], duration_seconds: int = 0) -> void:
if not AuthState.can_send_authenticated_request() or question_id == "" or choice_id == "":
return
_enqueue_attempt("answer", question_id, choice_id, presented_choice_ids)
_enqueue_attempt("answer", question_id, choice_id, presented_choice_ids, duration_seconds)
func skip_question(question_id: String) -> void:
@@ -386,7 +386,7 @@ func _on_retry_timer_timeout() -> void:
load_questions_from_api(false)
func _enqueue_attempt(kind: String, question_id: String, choice_id: String, presented_choice_ids: Array = []) -> void:
func _enqueue_attempt(kind: String, question_id: String, choice_id: String, presented_choice_ids: Array = [], duration_seconds: int = 0) -> void:
var account := AuthState.username.strip_edges()
if account == "":
return
@@ -399,6 +399,7 @@ func _enqueue_attempt(kind: String, question_id: String, choice_id: String, pres
"question_id": question_id,
"choice_id": choice_id,
"presented_choice_ids": presented_choice_ids.duplicate(),
"duration_seconds": maxi(0, duration_seconds),
"retry_count": 0
})
_save_attempt_queue()
@@ -430,7 +431,8 @@ func _process_attempt_queue() -> void:
var body := JSON.stringify({
"questionExternalId": question_id,
"choiceId": str(queued.get("choice_id", "")),
"presentedChoiceIds": queued.get("presented_choice_ids", [])
"presentedChoiceIds": queued.get("presented_choice_ids", []),
"durationSeconds": int(queued.get("duration_seconds", 0))
})
if str(queued.get("kind", "answer")) == "skip":
url = "%s/%s/skip" % [question_api_base_url.rstrip("/"), question_id.uri_encode()]