Skip to content

Commit

Permalink
Remove unused championship code and add back tests
Browse files Browse the repository at this point in the history
  • Loading branch information
axelclark committed Feb 27, 2024
1 parent 28e0c63 commit 7f810bf
Show file tree
Hide file tree
Showing 13 changed files with 42 additions and 548 deletions.
2 changes: 0 additions & 2 deletions lib/ex338_web.ex
Original file line number Diff line number Diff line change
Expand Up @@ -116,8 +116,6 @@ defmodule Ex338Web do

# Import LiveView helpers (live_render, live_component, live_patch, etc)

import Ex338Web.CoreComponents

# Import basic rendering functionality (render, render_layout, etc)
import Ex338Web.ErrorHelpers
import Ex338Web.Gettext
Expand Down
32 changes: 16 additions & 16 deletions lib/ex338_web/controllers/championship_html.ex
Original file line number Diff line number Diff line change
Expand Up @@ -460,6 +460,22 @@ defmodule Ex338Web.ChampionshipHTML do
Enum.filter(championships, &(&1.category == category))
end

def show_create_slots(%{admin: true}, %{category: "event", championship_slots: []}) do
true
end

def show_create_slots(_user, _championship) do
false
end

def show_create_picks(%{admin: true}, %{in_season_draft: true, in_season_draft_picks: []}) do
true
end

def show_create_picks(_user, _championship) do
false
end

def display_drafted_at_or_pick_due_at(%{available_to_pick?: false, drafted_player_id: nil}) do
"---"
end
Expand Down Expand Up @@ -489,20 +505,4 @@ defmodule Ex338Web.ChampionshipHTML do
def display_drafted_at_or_pick_due_at(pick) do
short_time_pst(pick.drafted_at)
end

def show_create_slots(%{admin: true}, %{category: "event", championship_slots: []}) do
true
end

def show_create_slots(_user, _championship) do
false
end

def show_create_picks(%{admin: true}, %{in_season_draft: true, in_season_draft_picks: []}) do
true
end

def show_create_picks(_user, _championship) do
false
end
end
8 changes: 7 additions & 1 deletion lib/ex338_web/live/championship_live.ex
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,13 @@ defmodule Ex338Web.ChampionshipLive do
@moduledoc false
use Ex338Web, :live_view

import Ex338Web.ChampionshipHTML, only: [display_drafted_at_or_pick_due_at: 1]
import Ex338Web.CoreComponents

alias Ex338.Accounts
alias Ex338.Championships
alias Ex338.FantasyLeagues
alias Ex338.InSeasonDraftPicks
alias Ex338Web.ChampionshipView

def mount(_params, session, socket) do
if connected?(socket) do
Expand Down Expand Up @@ -147,4 +149,8 @@ defmodule Ex338Web.ChampionshipLive do
end

defp maybe_put_flash(socket, _, _), do: socket

def display_autodraft_setting(:single), do: "⚠️ Make Pick & Pause"
def display_autodraft_setting(:on), do: "✅ On"
def display_autodraft_setting(:off), do: "❌ Off"
end
47 changes: 0 additions & 47 deletions lib/ex338_web/templates/championship/draft_table.html.leex

This file was deleted.

30 changes: 0 additions & 30 deletions lib/ex338_web/templates/championship/final_results_table.html.eex

This file was deleted.

11 changes: 0 additions & 11 deletions lib/ex338_web/templates/championship/index.html.eex

This file was deleted.

36 changes: 0 additions & 36 deletions lib/ex338_web/templates/championship/results_table.html.eex

This file was deleted.

192 changes: 0 additions & 192 deletions lib/ex338_web/templates/championship/show.html.eex

This file was deleted.

Loading

0 comments on commit 7f810bf

Please sign in to comment.