diff --git a/lib/runosaari/registration.ex b/lib/runosaari/registration.ex index f5472ed..2fcd0d1 100644 --- a/lib/runosaari/registration.ex +++ b/lib/runosaari/registration.ex @@ -1,4 +1,6 @@ defmodule Runosaari.Registration do + import Enum + @moduledoc """ The Registration context. """ @@ -22,16 +24,19 @@ defmodule Runosaari.Registration do end @doc """ - Returns the list of performers. + Returns the :seqnum sorted list of confirmed performers. ## Examples - iex> list_performers() + iex> list_sorted_confirmed_performers() [%Performer{}, ...] """ - def list_sorted_performers do - Repo.all(Performer |> order_by(:seqnum)) + def list_sorted_confirmed_performers do + Performer + |> where([p], p.confirmed == true) + |> order_by(:seqnum) + |> Repo.all() end @doc """ diff --git a/lib/runosaari_web/controllers/performer_controller.ex b/lib/runosaari_web/controllers/performer_controller.ex index 03669d5..fba9a22 100644 --- a/lib/runosaari_web/controllers/performer_controller.ex +++ b/lib/runosaari_web/controllers/performer_controller.ex @@ -5,7 +5,7 @@ defmodule RunosaariWeb.PerformerController do alias Runosaari.Registration.Performer def index(conn, _params) do - performers = Registration.list_sorted_performers() + performers = Registration.list_sorted_confirmed_performers() render(conn, "index.html", performers: performers) end diff --git a/lib/runosaari_web/templates/performer/index.html.eex b/lib/runosaari_web/templates/performer/index.html.eex index 7fad525..7082002 100644 --- a/lib/runosaari_web/templates/performer/index.html.eex +++ b/lib/runosaari_web/templates/performer/index.html.eex @@ -1,12 +1,12 @@

Esiintyjät

+<%= if length(@performers) == 0 do %> + Lisätietoja tulossa myöhemmin! +<% end %> <%= for performer <- @performers do %> - <%= if performer.confirmed == true do %> -

<%= performer.fname %> <%= performer.lname %>

-

<%= performer.desc %>

- <% end %> +

<%= performer.fname %> <%= performer.lname %>

+

<%= performer.desc %>

<% end %> -<%= link "Hallinta", to: Routes.admin_performer_path(@conn, :admin) %>