Sort yield list by date descending
This commit is contained in:
@@ -21,6 +21,10 @@ defmodule Osuuspuutarha.Harvest do
|
|||||||
Repo.all(Yield)
|
Repo.all(Yield)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def get_sorted_by_date do
|
||||||
|
Repo.all(Yield |> order_by({:desc, :date}))
|
||||||
|
end
|
||||||
|
|
||||||
@doc """
|
@doc """
|
||||||
Gets a single yield.
|
Gets a single yield.
|
||||||
|
|
||||||
|
|||||||
@@ -41,6 +41,6 @@ defmodule OsuuspuutarhaWeb.YieldLive.Index do
|
|||||||
end
|
end
|
||||||
|
|
||||||
defp list_yields do
|
defp list_yields do
|
||||||
Harvest.list_yields()
|
Harvest.get_sorted_by_date()
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
Reference in New Issue
Block a user