Skip to content
Snippets Groups Projects
Commit caeb5148 authored by Kerdo Kurs's avatar Kerdo Kurs
Browse files

fix advanced search location splitting

parent 79076d7f
No related branches found
No related tags found
No related merge requests found
Pipeline #47355 passed
......@@ -20,6 +20,7 @@ defmodule PropTrackrWeb.SearchController do
max_rooms = from(p in Property, select: max(p.room_count)) |> Repo.one
locations = from(p in Property, select: p.location) |> Repo.all
locations = locations |> Enum.filter(fn loc -> length(String.split(loc, ",")) >= 2 end)
cities = Enum.map(locations, fn location -> String.split(location, ",") |> hd |> String.trim() end)
cities = Enum.uniq(cities)
countries = Enum.map(locations, fn location -> String.split(location, ",") |> tl |> hd |> String.trim() end)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment