Skip to content

Commit

Permalink
Filter competitions by both name and short name in search (#250)
Browse files Browse the repository at this point in the history
  • Loading branch information
maxidragon authored Jan 10, 2025
1 parent 729e63d commit bac7352
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion lib/wca_live/competitions.ex
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,9 @@ defmodule WcaLive.Competitions do

defp filter_by_text(query, filter) do
filter = filter |> String.trim() |> String.replace(~r/\s+/, " ")
from c in query, where: ilike(c.name, ^"%#{filter}%")

from c in query,
where: ilike(c.name, ^"%#{filter}%") or ilike(c.short_name, ^"%#{filter}%")
end

defp where_start_date_gte(query, nil), do: query
Expand Down

0 comments on commit bac7352

Please sign in to comment.