Skip to content

Commit

Permalink
added join to all available tickets with one visit to DB
Browse files Browse the repository at this point in the history
  • Loading branch information
MICHAELMUNAVU83 committed Oct 24, 2023
1 parent 9210612 commit 6b48499
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions lib/elixir_conf_africa/events.ex
Original file line number Diff line number Diff line change
Expand Up @@ -32,11 +32,11 @@ defmodule ElixirConfAfrica.Events do
end

def get_all_available_tickets do
get_elixir_conf_event = get_elixir_conf_event()

query =
from t in TicketType,
where: t.event_id == ^get_elixir_conf_event.id,
join: e in Event,
on: t.event_id == e.id,
where: e.name == ^"ElixirConf Africa 2024",
select: sum(t.number)

Repo.one(query)
Expand Down

0 comments on commit 6b48499

Please sign in to comment.