More debug points

qa/10.0.0
Rick Carlino 2020-05-17 09:40:48 -05:00
parent 4317a32a1c
commit 75604c5b34
4 changed files with 43 additions and 18 deletions

View File

@ -1 +1 @@
10.0.0-rc33
10.0.0-rc34

View File

@ -1,4 +1,6 @@
defmodule FarmbotCeleryScript.Compiler.UpdateResource do
require FarmbotCore.Logger
alias FarmbotCeleryScript.{AST, DotProps}
def update_resource(%AST{args: args, body: body}, _env) do
@ -7,10 +9,6 @@ defmodule FarmbotCeleryScript.Compiler.UpdateResource do
variable = unquote(Map.fetch!(args, :resource))
update = unquote(unpair(body, %{}))
if update["y"] do
IO.puts(" In update_resource_compiler y is #{inspect(update["y"])}")
end
# Go easy on the API...
case variable do
%AST{kind: :identifier} ->
@ -32,6 +30,16 @@ defmodule FarmbotCeleryScript.Compiler.UpdateResource do
end
def do_update(%{pointer_id: id, pointer_type: kind}, update_params) do
y = update_params["y"]
msg =
if y do
"In #{__MODULE__}, y is #{y}"
else
"#{__MODULE__} was not provided a y value"
end
FarmbotCore.Logger.error(3, msg)
FarmbotCeleryScript.SysCalls.update_resource(kind, id, update_params)
end

View File

@ -46,8 +46,20 @@ defmodule FarmbotCore.Asset.Private do
# error being thrown.
changeset = LocalMeta.changeset(local_meta, Map.merge(params, %{table: table, status: "dirty"}))
try do
result = Repo.insert_or_update!(changeset)
%FarmbotCore.Asset.Private.LocalMeta{} = result
result = Repo.insert_or_update!(changeset)
if table == "points" do
y = asset.y
msg =
if y do
"In #{__MODULE__}, y is #{y}"
else
"#{__MODULE__} was not provided a y value"
end
FarmbotCore.Logger.error(3, msg)
end
result
catch
:error, %Sqlite.DbConnection.Error{

View File

@ -53,6 +53,16 @@ defmodule FarmbotOS.SysCalls.ResourceUpdate do
end
def update_resource(kind, id, params) when kind in @point_kinds do
y = params["y"]
msg =
if y do
"In #{__MODULE__}, y is #{y}"
else
"#{__MODULE__} was not provided a y value"
end
FarmbotCore.Logger.error(3, msg)
notify_user_of_updates(kind, params)
params = do_handlebars(params)
point_update_resource(kind, id, params)
@ -69,21 +79,16 @@ defmodule FarmbotOS.SysCalls.ResourceUpdate do
def point_update_resource(type, id, params) do
with %{} = point <- Asset.get_point(id: id),
{:ok, point} <- Asset.update_point(point, params) do
real_y = point.y
y = point.y
if params["y"] do
{desired_y, _} = Float.parse(params["y"])
if real_y != desired_y do
FarmbotCore.Logger.error(3, "Y does not match up #{__MODULE__}")
raise "Y WAS NOT Correct #{inspect({real_y, desired_y})} @@@@"
msg =
if y do
"In #{__MODULE__}, y is #{y}"
else
IO.puts(
" point.y = \"#{real_y}\""
)
"#{__MODULE__} was not provided a y value"
end
end
FarmbotCore.Logger.error(3, msg)
_ = Private.mark_dirty!(point)
:ok
else