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
+9 -4
View File
@@ -90,10 +90,15 @@ defmodule Chesstrainer.Endgames.Endgame do
defp normalize_attrs(attrs), do: attrs
# Strict structural validation. Mirrors chess.js rules so the FEN survives
# both the server-side parser (Chex, permissive) and the client-side parser
# (chess.js, strict).
defp fen_issues(fen) do
@doc """
Returns the structural problems with a FEN, or `[]` when it is well formed.
Strict structural validation. Mirrors chess.js rules so the FEN survives
both the server-side parser (Chex, permissive) and the client-side parser
(chess.js, strict). Used by the admin bulk importer to explain why a line
was rejected.
"""
def fen_issues(fen) do
case String.split(fen, " ") do
[board, active, _castling, _en_passant, halfmove, fullmove] ->
board_valid? = valid_board?(board)