fix: simple equality filter should not traverse ors

This commit is contained in:
Zach Daniel 2023-04-22 08:26:21 -06:00
parent 51d0eeb08b
commit ba1fa4c6d5

View file

@ -783,13 +783,15 @@ defmodule Ash.Filter do
"""
def find_simple_equality_predicate(expression, attribute) do
expression
|> find(&simple_eq?(&1, attribute))
|> find(&simple_eq?(&1, attribute), false)
|> case do
nil ->
nil
%{right: right} ->
right
%{right: right, left: left} ->
Enum.find([right, left], fn value ->
!Ash.Filter.TemplateHelpers.expr?(value)
end)
end
end