mirror of
https://github.com/TheRealOwenRees/chess-endgame-trainer.git
synced 2026-11-18 11:42:07 +00:00
Tablebase failures now render one message per class, with a Retry action when fetching again can help. The generic class no longer interpolates inspect(reason) into the page; the reason goes to the log instead. Positions outside the tablebase offer the next puzzle (in a session) or the existing back link, rather than a futile retry. Train's no-puzzles and exhausted-difficulty flashes become in-page states with Retry and Change difficulty. The guest pool gets the same treatment, and GuestLimits.remaining/1 lets a guest see the wall, or the empty pool, without spending a puzzle.
This commit is contained in:
@@ -37,9 +37,21 @@ defmodule Chesstrainer.GuestLimitsTest do
|
||||
assert {:ok, 4} = GuestLimits.take(@other, @today)
|
||||
end
|
||||
|
||||
test "remaining reports the budget without consuming it" do
|
||||
assert {:ok, 5} = GuestLimits.remaining(@address, @today)
|
||||
assert {:ok, 5} = GuestLimits.remaining(@address, @today)
|
||||
|
||||
assert {:ok, 4} = GuestLimits.take(@address, @today)
|
||||
assert {:ok, 4} = GuestLimits.remaining(@address, @today)
|
||||
|
||||
for _ <- 1..4, do: assert({:ok, _} = GuestLimits.take(@address, @today))
|
||||
assert {:limit_reached, _} = GuestLimits.remaining(@address, @today)
|
||||
end
|
||||
|
||||
test "does not limit a missing address" do
|
||||
assert {:ok, nil} = GuestLimits.take(nil, @today)
|
||||
assert {:ok, nil} = GuestLimits.take(nil, @today)
|
||||
assert {:ok, nil} = GuestLimits.remaining(nil, @today)
|
||||
end
|
||||
|
||||
test "reset clears spent budgets" do
|
||||
|
||||
Reference in New Issue
Block a user