Archive page
This commit is contained in:
@@ -33,6 +33,24 @@ defmodule Runosaari.Registration do
|
||||
def list_sorted_confirmed_performers do
|
||||
Performer
|
||||
|> where([p], p.confirmed == true)
|
||||
|> where([p], is_nil(p.archived))
|
||||
|> order_by(:name)
|
||||
|> Repo.all()
|
||||
end
|
||||
|
||||
@doc """
|
||||
Returns the :name sorted list of archived performers by year.
|
||||
|
||||
## Examples
|
||||
|
||||
iex> list_sorted_confirmed_performers()
|
||||
[%Performer{}, ...]
|
||||
|
||||
"""
|
||||
def list_sorted_archived_performers(year) do
|
||||
Performer
|
||||
|> where([p], not is_nil(p.archived))
|
||||
|> where([p], p.archived == ^year)
|
||||
|> order_by(:name)
|
||||
|> Repo.all()
|
||||
end
|
||||
|
||||
@@ -12,6 +12,7 @@ defmodule Runosaari.Registration.Performer do
|
||||
field :link, :string
|
||||
field :photo_path, :string
|
||||
field :confirmed, :boolean, default: false
|
||||
field :archived, :integer
|
||||
|
||||
timestamps()
|
||||
end
|
||||
@@ -28,7 +29,8 @@ defmodule Runosaari.Registration.Performer do
|
||||
:paragraph5,
|
||||
:link,
|
||||
:photo_path,
|
||||
:confirmed
|
||||
:confirmed,
|
||||
:archived
|
||||
])
|
||||
|> validate_required([
|
||||
:name,
|
||||
|
||||
@@ -31,7 +31,7 @@ defmodule Runosaari.Schedule do
|
||||
|
||||
"""
|
||||
def list_sorted_performances do
|
||||
Repo.all(Performance |> order_by(:seqnum))
|
||||
Repo.all(Performance |> where([p], not is_nil(p.seqnum)) |> order_by(:seqnum))
|
||||
end
|
||||
|
||||
@doc """
|
||||
|
||||
Reference in New Issue
Block a user