mirror of
https://github.com/TheRealOwenRees/chess-endgame-trainer.git
synced 2026-11-18 11:42:07 +00:00
Rename Tag to Theme across code and schema
Rename the endgame-label concept from Tag to Theme to match the glossary: the context becomes Chesstrainer.Themes, the schema Chesstrainer.Themes.Theme, and the Endgame association is :themes. The category enum (endgame/opening/tactic) is preserved. Rewrite the original migrations in place so themes / endgames_themes (with theme_id) are created directly, instead of adding a transition migration. Closes #12
This commit is contained in:
@@ -3,7 +3,7 @@ defmodule ChesstrainerWeb.EndgameLive.Index do
|
||||
|
||||
alias Chesstrainer.Endgames
|
||||
alias Chesstrainer.Repo
|
||||
alias Chesstrainer.Tags
|
||||
alias Chesstrainer.Themes
|
||||
|
||||
@impl true
|
||||
def render(assigns) do
|
||||
@@ -31,7 +31,7 @@ defmodule ChesstrainerWeb.EndgameLive.Index do
|
||||
<:col :let={{_id, endgame}} label="Notes">{endgame.notes}</:col>
|
||||
<:col :let={{_id, endgame}} label="Result">{endgame.result}</:col>
|
||||
<:col :let={{_id, endgame}} label="Themes">
|
||||
{Enum.join(Tags.names(endgame.tags), ", ")}
|
||||
{Enum.join(Themes.names(endgame.themes), ", ")}
|
||||
</:col>
|
||||
<:col :let={{_id, endgame}} label="Attempted">{endgame.times_attempted}</:col>
|
||||
<:col :let={{_id, endgame}} label="Solved">{endgame.times_solved}</:col>
|
||||
@@ -72,6 +72,6 @@ defmodule ChesstrainerWeb.EndgameLive.Index do
|
||||
end
|
||||
|
||||
defp list_endgames() do
|
||||
Endgames.list_endgames() |> Repo.preload(:tags)
|
||||
Endgames.list_endgames() |> Repo.preload(:themes)
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user