v9.2.2-rc20 - Possible fix for time-based criteria.

qa/reset_fixes
Rick Carlino 2020-04-13 12:21:19 -05:00
parent bfb4f21f54
commit 7ca2725540
3 changed files with 7 additions and 5 deletions

View File

@ -1 +1 @@
9.2.2-rc20
9.2.2-rc21

View File

@ -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

View File

@ -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"]