Add admin bulk FEN importer (#156)

* change position of theme picker

* Add admin bulk FEN importer

Paste FENs, resolve results from the local Syzygy tablebase only, preview each line's status, and bulk insert with themes and a batch rating.
This commit is contained in:
2026-11-12 22:44:13 +01:00
committed by GitHub
parent 20b53dae6f
commit fddb94e2bd
13 changed files with 1010 additions and 107 deletions
+14
View File
@@ -12,6 +12,7 @@ defmodule Chesstrainer.Endgames.Tablebase do
"""
alias Chesstrainer.Endgames.Tablebase
alias Chesstrainer.Endgames.Tablebase.Backend.Fathom, as: FathomBackend
alias Chesstrainer.FEN
@type result :: :win | :draw | :loss | :unknown
@@ -67,6 +68,19 @@ defmodule Chesstrainer.Endgames.Tablebase do
def flip(:draw), do: :draw
def flip(_outcome), do: :unknown
@doc """
Probes a FEN using only the local Syzygy tablebase and returns the result
from the side-to-move's perspective.
Unlike `new/1` this never falls back to the remote backend and never reads or
writes the cache. It is the primitive behind the admin bulk importer, so an
imported result always comes from our own tablebases.
"""
@spec probe_local_result(String.t()) ::
{:ok, result()}
| {:error, :not_configured | :illegal | :terminal | :unsupported}
def probe_local_result(fen), do: FathomBackend.probe_result_local(fen)
@spec new(String.t()) ::
{:ok, t()}
| {:cooldown, non_neg_integer()}