Added BiddingRoundServer "CurrentRoundServer" with a facade to control it. "Listing Biddings" page shows information which round is currently running.

This commit is contained in:
2026-02-12 12:23:21 +01:00
parent 04c79d341c
commit 6eea9d2fba
5 changed files with 240 additions and 10 deletions

View File

@ -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.