Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot delete or update EconomicEvents #33

Open
vcuculo opened this issue Feb 17, 2022 · 2 comments
Open

Cannot delete or update EconomicEvents #33

vcuculo opened this issue Feb 17, 2022 · 2 comments

Comments

@vcuculo
Copy link

vcuculo commented Feb 17, 2022

The following

mutation {
  deleteEconomicEvent(id:"01FW1CW5D981XA7912559ZZBES")
}

results in

""

while in backend

11:16:49.210 [error] #PID<0.10648.6> running Bonfire.Web.Endpoint (connection #PID<0.10647.6>, stream id 1) terminated
Server: 2.235.105.83:4000 (http)
Request: POST /api/graphql
** (exit) an exception was raised:
    ** (Protocol.UndefinedError) protocol Jason.Encoder not implemented for {:safe, "<!DOCTYPE html>\n<html lang=\"en\" class=\"dark\">\n<head>\n<meta charset=\"utf-8\"/>\n<meta http-equiv=\"X-UA-Compatible\" content=\"IE=edge\"/>\n<meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\"/>\n<meta name=\"description\" content=\"Bonfire instance\">\n<meta name=\"keywords\" content=\"bonfire, fediverse\">\n<meta name=\"author\" content=\"Bonfire\">\n<title data-suffix=\" · Bonfire\">Error · Bonfire</title>\n<link phx-track-static rel='stylesheet' href='/css/bonfire.css'/>\n</head>\n\n<body id=\"layout-root\" class=\"bg-blueGray-50 dark:bg-neutral-800\">\n<div data-phx-main=\"true\"><div id=\"layout-error\">\n<div class=\"\">\n<div class=\"flex flex-col mx-auto overflow-hidden lg:mt-4\">\n<div class=\"relative z-10 flex justify-between flex-shrink-0 h-16\">\n  <div class=\"flex items-center flex-shrink-0 lg:px-4\">\n    <a data-phx-link=\"redirect\" data-phx-link-state=\"push\" href=\"/\">\n      <div class=\"flex items-center px-4 py-2 rounded\">\n\n        <div class=\"w-10 h-10 bg-center bg-no-repeat bg-contain\" style=\"background-image: url(https://bonfirenetworks.org/img/bonfire.png)\"></div>\n      </div>\n    </a>\n\n    <div class=\"flex flex-1\">\n    </div>\n  </div>\n\n</div>\n</div>\n\n<div class=\"mx-auto mt-12 w-center\">\n  <div class=\"prose\">\n    <h1 class=\"text-primary-content-900\">\n      Internal Server Error\n    </h1>\n      \n  </div>\n</div>\n</div>\n</div>\n</div>\n</html>\n"} of type Tuple, Jason.Encoder protocol must always be explicitly implemented. This protocol is implemented for the following type(s): Geo.MultiPointZ, Geo.MultiLineStringZ, Geo.Polygon, Geo.PolygonZ, Geo.Point, Geo.LineStringZ, Geo.LineString, Geo.PointM, Geo.MultiPolygon, Geo.MultiPoint, Geo.PointZ, Geo.MultiPolygonZ, Geo.PointZM, Geo.GeometryCollection, Geo.MultiLineString, Cldr.LanguageTag, Ecto.Schema.Metadata, Ecto.Association.NotLoaded, BitString, List, Integer, Jason.OrderedObject, Float, NaiveDateTime, Time, Map, Date, Decimal, Any, Atom, Jason.Fragment, DateTime
        (jason 1.3.0) lib/jason.ex:213: Jason.encode_to_iodata!/2
        (phoenix 1.6.5) lib/phoenix/controller.ex:772: Phoenix.Controller.render_and_send/4
        (phoenix 1.6.5) lib/phoenix/endpoint/render_errors.ex:78: Phoenix.Endpoint.RenderErrors.instrument_render_and_send/5
        (phoenix 1.6.5) lib/phoenix/endpoint/render_errors.ex:64: Phoenix.Endpoint.RenderErrors.__catch__/5
        (phoenix 1.6.5) lib/phoenix/endpoint/cowboy2_handler.ex:54: Phoenix.Endpoint.Cowboy2Handler.init/4
        (cowboy 2.9.0) /opt/app/deps/cowboy/src/cowboy_handler.erl:37: :cowboy_handler.execute/2
        (cowboy 2.9.0) /opt/app/deps/cowboy/src/cowboy_stream_h.erl:306: :cowboy_stream_h.execute/3
        (cowboy 2.9.0) /opt/app/deps/cowboy/src/cowboy_stream_h.erl:295: :cowboy_stream_h.request_process/3
@fosterlynn
Copy link

I can't speak to the implementation, but in Valueflows, we recommend that an EconomicEvent not be deletable. This is because you never know when accounting reports might have picked it up. So it must be "backed out" by an opposing EconomicEvent that nets the resource effect to zero. Some event actions have naturally opposing ones, some don't. Events are designed to not need to use negative quantities in "normal" operation (i.e. different events naturally decrement or increment resources), but we will have to allow them for backing some things out.

Also note that fields you cannot update in EconomicEvent are: resourceQuantity, effortQuantity, atLocation, inScopeOf, resourceConformsTo, resourceInventoriedAs, provider, receiver, action, hasBeginning, hasEnd, hasPointInTime, inScopeOf. Same reasoning, these could possibly affect the accounting derived from events.

@vcuculo
Copy link
Author

vcuculo commented Feb 21, 2022

I understand, thank you @fosterlynn for the clarification.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants