Add rating window and time-based RD inflation (#41)

This commit is contained in:
2026-11-03 22:20:02 +01:00
parent 4a36ffd2e6
commit 160e8629b7
6 changed files with 251 additions and 25 deletions
+12 -4
View File
@@ -690,11 +690,19 @@ defmodule ChesstrainerWeb.EndgameLive.Play do
defp record_attempt(socket, outcome) do
case Attempts.record_attempt(socket.assigns.current_scope, socket.assigns.endgame, outcome) do
{:ok, attempt} ->
{:ok, %{user: user, endgame: endgame}} = Ratings.rate_attempt(attempt)
case Ratings.rate_attempt(attempt) do
{:ok, %{user: user, endgame: endgame}} ->
socket
|> assign(:endgame, endgame)
|> assign(:user_rating, user.rating)
socket
|> assign(:endgame, endgame)
|> assign(:user_rating, user.rating)
{:skipped, _attempt} ->
put_flash(
socket,
:info,
"Replay recorded. Your rating is unchanged because you played this recently."
)
end
_ ->
socket