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
+8 -3
View File
@@ -5,7 +5,7 @@ const Style := preload("res://scripts/ui/ui_style.gd")
var main: Control
var status_label: Label
var daily_label: Label
var xp_label: Label
var elo_label: Label
var streak_label: Label
var bank_label: Label
var error_label: Label
@@ -17,6 +17,8 @@ func _ready() -> void:
add_theme_constant_override("separation", 18)
if not QuestionBankService.questions_changed.is_connected(_refresh):
QuestionBankService.questions_changed.connect(_refresh)
if not QuestionBankService.ratings_changed.is_connected(_refresh):
QuestionBankService.ratings_changed.connect(_refresh)
if not ProfileService.profile_changed.is_connected(_refresh):
ProfileService.profile_changed.connect(_refresh)
@@ -36,7 +38,7 @@ func _ready() -> void:
add_child(summary)
daily_label = _add_metric(summary, "Today")
xp_label = _add_metric(summary, "Daily XP")
elo_label = _add_metric(summary, "ELO")
streak_label = _add_metric(summary, "Streak")
bank_label = _add_metric(summary, "Question Bank")
@@ -115,7 +117,10 @@ func _refresh() -> void:
if progress > 100:
progress = 100
daily_label.text = "Today\n%d/%d questions\n%d%% complete" % [answered, goal, progress]
xp_label.text = "Daily XP\n%d XP earned" % int(profile.get("daily_xp_earned", 0))
elo_label.text = "ELO\n%d overall\n%d rated" % [
QuestionBankService.overall_elo,
QuestionBankService.rated_question_count
]
streak_label.text = "Streak\n%d current\n%d best" % [
int(profile.get("current_streak", 0)),
int(profile.get("best_streak", 0))