Skip to content

Commit

Permalink
chore: mix quality
Browse files Browse the repository at this point in the history
  • Loading branch information
Gabrielparizet committed Nov 7, 2024
1 parent 0e110dc commit acbf537
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
3 changes: 2 additions & 1 deletion lib/book_my_gigs/events.ex
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,8 @@ defmodule BookMyGigs.Events do
|> Enum.map(&to_context_struct/1)
end

def get_events_by_location(location_name, genre_names, type_name) when is_list(genre_names) and type_name != nil do
def get_events_by_location(location_name, genre_names, type_name)
when is_list(genre_names) and type_name != nil do
location_name
|> Storage.get_events_by_location_genres_and_type(genre_names, type_name)
|> Enum.map(&to_context_struct/1)
Expand Down
5 changes: 4 additions & 1 deletion lib/book_my_gigs/events/storage.ex
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,10 @@ defmodule BookMyGigs.Events.Storage do

Event
|> join(:inner, [e], eg in EventGenre, on: e.id == eg.event_id)
|> where([e, eg], e.location_id == ^location_id and e.type_id == ^type_id and eg.genre_id in ^genre_ids)
|> where(
[e, eg],
e.location_id == ^location_id and e.type_id == ^type_id and eg.genre_id in ^genre_ids
)
|> distinct([e], e.id)
|> Repo.all()
|> Enum.map(&Repo.preload(&1, [:location, :type, :genres, :user]))
Expand Down

0 comments on commit acbf537

Please sign in to comment.