show live player count on landing page

This commit is contained in:
2026-11-05 16:40:58 +01:00
parent 8d1876b13b
commit 2f3f39a21d
7 changed files with 64 additions and 16 deletions
+11
View File
@@ -59,6 +59,17 @@ defmodule Chesstrainer.Attempts do
|> Repo.one()
end
@doc """
Returns the number of users who have recorded at least one attempt.
A retry does not count twice: the count is over distinct users.
"""
def count_users_with_attempts do
Attempt
|> select([a], count(a.user_id, :distinct))
|> Repo.one()
end
@doc """
The distinct endgame ids `user_id` has attempted in the last `days` days.