Skip to content

Commit

Permalink
add date case to greater than
Browse files Browse the repository at this point in the history
  • Loading branch information
michaelst committed Nov 13, 2021
1 parent 1fcb69b commit 8015a7f
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions lib/ash/query/operator/greater_than.ex
Expand Up @@ -14,6 +14,12 @@ defmodule Ash.Query.Operator.GreaterThan do
{:known, Comp.greater_than?(left, right)}
end

def simplify(%__MODULE__{left: %Ref{} = ref, right: %Date{} = value}) do
{:ok, op} = Ash.Query.Operator.new(Ash.Query.Operator.LessThan, ref, Date.add(value, 1))

Ash.Query.Not.new(op)
end

def simplify(%__MODULE__{left: %Ref{} = ref, right: value}) when is_integer(value) do
{:ok, op} = Ash.Query.Operator.new(Ash.Query.Operator.LessThan, ref, value + 1)

Expand Down

0 comments on commit 8015a7f

Please sign in to comment.