Skip to content
Snippets Groups Projects

Implement searching, storing and revisiting searches

3 files
+ 342
7
Compare changes
  • Side-by-side
  • Inline
Files
3
+ 1
6
@@ -46,6 +46,7 @@ defmodule PropTrackr.Search do
p in Property,
left_join: ni in NotInterested,
on: ni.property_id == p.id and ni.user_id == ^(current_user_id || 0),
where: p.location in ^locations,
order_by: [asc: not is_nil(ni.id), asc: p.state, asc: p.inserted_at],
where: p.price >= ^struct.min_price,
where: p.price <= ^struct.max_price,
@@ -56,12 +57,6 @@ defmodule PropTrackr.Search do
select: p,
)
query = if locations == [] do
query
else
query |> where([p], p.location in ^locations)
end
query = if struct.type == :any do
query
else
Loading