Added BiddingRoundServer "CurrentRoundServer" with a facade to control it. "Listing Biddings" page shows information which round is currently running.
This commit is contained in:
@ -37,6 +37,27 @@ defmodule BeetRoundServer.BiddingRounds do
|
||||
"""
|
||||
def get_bidding_round!(id), do: Repo.get!(BiddingRound, id)
|
||||
|
||||
def get_highest_bidding_round!() do
|
||||
query =
|
||||
Ecto.Query.from(bidding_round in BiddingRound,
|
||||
order_by: [desc: bidding_round.round_number],
|
||||
limit: 1
|
||||
)
|
||||
|
||||
Repo.one(query)
|
||||
end
|
||||
|
||||
def get_bidding_round_by_number!(round_number) do
|
||||
query =
|
||||
Ecto.Query.from(bidding_round in BiddingRound,
|
||||
where: bidding_round.round_number == ^round_number,
|
||||
order_by: [desc: bidding_round.inserted_at],
|
||||
limit: 1
|
||||
)
|
||||
|
||||
Repo.one(query)
|
||||
end
|
||||
|
||||
@doc """
|
||||
Creates a bidding_round.
|
||||
|
||||
|
||||
Reference in New Issue
Block a user