Skip to content

Commit

Permalink
Fix search by company name and search by industry name
Browse files Browse the repository at this point in the history
  • Loading branch information
imahmedismail committed Dec 21, 2023
1 parent 911f91b commit 00615b2
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions lib/companies/helper.ex
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,18 @@ defmodule Companies.Helpers do

@default_page_size "16"

def searched_list(list, _params) do
list
def searched_list(list, params) do
search_param = params["search"]["text"]

if search_param do
list
|> Enum.filter(
&(String.contains?(String.downcase(&1.name), String.downcase(search_param)) or
String.contains?(String.downcase(&1.industry), String.downcase(search_param)))
)
else
list
end
end

def sorted_list(list, params) do
Expand Down

0 comments on commit 00615b2

Please sign in to comment.