mirror of
https://github.com/TheRealOwenRees/chess-endgame-trainer.git
synced 2026-11-18 03:32:06 +00:00
Count distinct users with a session token valid within the 14-day window and use it for the hero players-training stat. The learning strip keeps the total player count. Also load the split seed modules in seeds_test and drop an invalid 8-piece seed FEN so precommit passes.
65 lines
2.0 KiB
Elixir
65 lines
2.0 KiB
Elixir
defmodule ChesstrainerWeb.PageController do
|
|
use ChesstrainerWeb, :controller
|
|
|
|
alias Chesstrainer.Accounts
|
|
alias Chesstrainer.Attempts
|
|
alias Chesstrainer.Branding
|
|
alias Chesstrainer.DailyPuzzles
|
|
alias Chesstrainer.Endgames
|
|
|
|
@description "Short, focused endgame puzzles against tablebase-perfect defence. " <>
|
|
"Learn to see the winning move and make the endgame your strongest phase."
|
|
|
|
def home(conn, _params) do
|
|
endgames = Endgames.curated_endgames()
|
|
|
|
conn
|
|
|> assign(:js_entry, ~p"/assets/js/marketing.js")
|
|
|> assign(:page_title, Branding.home_title())
|
|
|> assign(:title_suffix, "")
|
|
|> assign(:meta_description, @description)
|
|
|> assign(:canonical_url, current_url(conn))
|
|
|> render(:home,
|
|
endgames: endgames,
|
|
active_endgame: DailyPuzzles.today(),
|
|
puzzle_count: Endgames.count_endgames(),
|
|
user_count: Attempts.count_users_with_attempts(),
|
|
logged_in_count: Accounts.count_logged_in_users(),
|
|
today: Date.utc_today()
|
|
)
|
|
end
|
|
|
|
def privacy(conn, _params) do
|
|
conn
|
|
|> assign(:js_entry, ~p"/assets/js/marketing.js")
|
|
|> assign(:page_title, Branding.title("Privacy Policy"))
|
|
|> assign(:title_suffix, "")
|
|
|> assign(
|
|
:meta_description,
|
|
"How #{Branding.name()} collects, uses, and protects your personal data."
|
|
)
|
|
|> assign(:canonical_url, current_url(conn))
|
|
|> render(:privacy)
|
|
end
|
|
|
|
def terms_conditions(conn, _params) do
|
|
conn
|
|
|> assign(:js_entry, ~p"/assets/js/marketing.js")
|
|
|> assign(:page_title, Branding.title("Terms & Conditions"))
|
|
|> assign(:title_suffix, "")
|
|
|> assign(:meta_description, "The terms that apply when you use #{Branding.name()}.")
|
|
|> assign(:canonical_url, current_url(conn))
|
|
|> render(:terms_conditions)
|
|
end
|
|
|
|
def not_found(conn, _params) do
|
|
conn
|
|
|> put_status(:not_found)
|
|
|> assign(:js_entry, ~p"/assets/js/marketing.js")
|
|
|> assign(:page_title, Branding.title("Page not found"))
|
|
|> assign(:title_suffix, "")
|
|
|> assign(:noindex, true)
|
|
|> render(:not_found)
|
|
end
|
|
end
|