Add study session goals and summaries
This commit is contained in:
@@ -25,6 +25,7 @@ var retained_count := 0
|
||||
var outbox: Array = []
|
||||
var active_account_key := ""
|
||||
var step3_system := ""
|
||||
var target_count := 20
|
||||
|
||||
|
||||
func _ready() -> void:
|
||||
@@ -49,8 +50,9 @@ func _ready() -> void:
|
||||
_on_auth_changed()
|
||||
|
||||
|
||||
func start_pass(requested_step3_system: String = "") -> void:
|
||||
func start_pass(requested_step3_system: String = "", requested_count: int = 20) -> void:
|
||||
step3_system = requested_step3_system
|
||||
target_count = clampi(requested_count, 1, 20)
|
||||
excluded_question_ids.clear()
|
||||
reviewed_count = 0
|
||||
cleared_count = 0
|
||||
@@ -59,6 +61,10 @@ func start_pass(requested_step3_system: String = "") -> void:
|
||||
|
||||
|
||||
func load_next() -> void:
|
||||
if reviewed_count >= target_count:
|
||||
StudySessionService.emit_deferred_summary()
|
||||
pass_completed.emit(get_summary())
|
||||
return
|
||||
if loading:
|
||||
return
|
||||
if not AuthState.can_send_authenticated_request():
|
||||
@@ -99,7 +105,8 @@ func record_first_submission(question: Dictionary, choice_id: String, presented_
|
||||
"cycle": current_cycle,
|
||||
"choiceId": choice_id,
|
||||
"presentedChoiceIds": presented_choice_ids.duplicate(),
|
||||
"durationSeconds": clampi(duration_seconds, 0, 86400)
|
||||
"durationSeconds": clampi(duration_seconds, 0, 86400),
|
||||
"studySessionId": StudySessionService.active_session_id
|
||||
}
|
||||
outbox.append({"account": _account_key(), "payload": payload, "retry_count": 0})
|
||||
_save_outbox()
|
||||
@@ -191,6 +198,7 @@ func _on_attempt_completed(result: int, response_code: int, _headers_value: Pack
|
||||
var synced_is_correct := false
|
||||
if typeof(parsed) == TYPE_DICTIONARY:
|
||||
CreditsService.apply_award_response(parsed)
|
||||
StudySessionService.apply_response(parsed, true)
|
||||
pending_count = int(parsed.get("pendingCount", parsed.get("pending_count", pending_count)))
|
||||
synced_question_id = str(parsed.get("questionExternalId", parsed.get("question_external_id", "")))
|
||||
synced_is_correct = bool(parsed.get("isCorrect", parsed.get("is_correct", false)))
|
||||
|
||||
Reference in New Issue
Block a user