Sort visitors in alphabetical order.

This commit is contained in:
codevictory
2021-07-19 17:45:56 +03:00
parent 12288ca3be
commit 04431b216d
2 changed files with 16 additions and 1 deletions

View File

@@ -133,6 +133,21 @@ defmodule Runosaari.Registration do
Repo.all(Visitor)
end
@doc """
Returns the alphabetically sorted list of visitors.
## Examples
iex> list_visitors()
[%Visitor{}, ...]
"""
def list_sorted_visitors do
Visitor
|> order_by(:lname)
|> Repo.all()
end
@doc """
Gets a single visitor.