Add server-side ELO ratings

This commit is contained in:
hz
2026-07-11 02:05:43 -05:00
parent bdd32c9dac
commit c716b16c53
21 changed files with 688 additions and 47 deletions
+32
View File
@@ -130,6 +130,29 @@ func submit_core_attempt(choice_id: String, eliminated: Array, flagged: bool) ->
}
func skip_core_question(eliminated: Array, flagged: bool) -> Dictionary:
var question := get_current_question()
if question.is_empty():
return {}
var answer := {
"question": question.duplicate(true),
"selected_choice_id": "",
"is_correct": false,
"is_skip": true,
"eliminated_choice_ids": eliminated.duplicate(),
"flagged": flagged,
"elapsed_seconds": get_current_elapsed_seconds(),
"target_seconds": core_current_target_seconds
}
answers[current_index] = answer
ProfileService.record_wrong_attempt(question)
_apply_core_wrong_penalty(answer)
core_target_seconds = min(CORE_MAX_TARGET_SECONDS, core_target_seconds * 1.05)
session_changed.emit()
return answer
func move_previous() -> bool:
if current_index > 0:
current_index -= 1
@@ -207,6 +230,15 @@ func update_question_choice_percentages(question_id: String, percentages: Dictio
break
func update_question_elo(question_id: String, question_elo: int) -> void:
for index in range(active_questions.size()):
var question: Dictionary = active_questions[index]
if str(question.get("id", "")) == question_id:
question["question_elo"] = question_elo
active_questions[index] = question
break
func advance_core_question() -> bool:
var question := _draw_core_question()
if question.is_empty():