Before code:
defp where_age_groups_in(queryable, %{selected_age_groups: age_groups}) do
Enum.reduce(age_groups, queryable, fn age_group, acc ->
case age_group do
"0-30" -> from(vi in acc, where: vi.age from(vi in acc, where: vi.age >= 30 and vi.age from(vi in acc, where: vi.age >= 60 and vi.age from(vi in acc, where: vi.age > 90)
_ -> acc
end
end)
end
defp where_age_groups_in(queryable, %{selected_age_groups: age_groups}) do
Enum.reduce(age_groups, queryable, fn age_group, acc ->
case age_group do
"0-30" -> from(vi in acc, where: vi.age from(vi in acc, where: vi.age >= 30 and vi.age from(vi in acc, where: vi.age >= 60 and vi.age from(vi in acc, where: vi.age > 90)
_ -> acc
end
end)
end