mirror of
https://github.com/TheRealOwenRees/chess-endgame-trainer.git
synced 2026-11-18 11:42:07 +00:00
show live player count on landing page
This commit is contained in:
@@ -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.
|
||||
|
||||
|
||||
Reference in New Issue
Block a user