v9.2.2-rc20 - Possible fix for time-based criteria.
parent
bfb4f21f54
commit
7ca2725540
|
@ -138,10 +138,12 @@ defmodule FarmbotCore.Asset.CriteriaRetriever do
|
|||
{ pg, accum }
|
||||
else
|
||||
|
||||
op = day_criteria["op"] || "<"
|
||||
time = Timex.shift(Timex.now(), days: -1 * days)
|
||||
op = day_criteria["op"] || ">"
|
||||
time = Timex.shift(Timex.now(), days: days)
|
||||
|
||||
{ pg, accum ++ [{"created_at", op, time}] }
|
||||
inverted_op = if op == ">" do "<" else ">" end
|
||||
|
||||
{ pg, accum ++ [{"created_at", inverted_op, time}] }
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
@ -13,7 +13,7 @@ defmodule FarmbotCore.Asset.CriteriaRetrieverTest do
|
|||
|
||||
@fake_point_group %PointGroup{
|
||||
criteria: %{
|
||||
"day" => %{"op" => "<", "days_ago" => 4},
|
||||
"day" => %{"op" => ">", "days_ago" => 4},
|
||||
"string_eq" => %{
|
||||
"openfarm_slug" => ["five", "nine"],
|
||||
"meta.created_by" => ["plant-detection"]
|
||||
|
|
Loading…
Reference in New Issue