Skip to content

Latest commit

 

History

History
75 lines (48 loc) · 5.41 KB

events.md

File metadata and controls

75 lines (48 loc) · 5.41 KB

Economic Events on Planning Page

This will support adding economic events that are based on the planned commitments.

UI

Adding an event

Each commitment should have a symbol added (beside the update and delete symbols) to indicate add/update an event. Or a button, suggestions welcome. (To keep things simple for this page, we can for now assume only one event per commitment. That will be mostly true for the CFN, possibly not as much for other networks. We will add a place on another page to allow more events per commitment.)

Pressing the symbol/button should bring up a modal.

Fields to include:

  • Provider - default from commitment
  • Receiver - default from commitment
  • Resource specification (name) - default from commitment
  • Resource quantity (numeric value + unit) - default from commitment
  • Date - default current
  • Description
  • Commitment finished - default true (can be a checkbox)

Optional, do if there is extra time: If the commitment is also part of an agreement (i.e. is showing the cost $), then also allow add/update of an event for that reciprocal commitment:

  • Payment quantity (numeric value + resource spec name, i.e. "Currency" like in offers modal) - default from reciprocal commitment
  • Tracking identifier (for check numbers, etc.)
  • Description

On the UI, update the background color of the commitment: If an event was saved with the Commitment finished not checked, then make it light yellow (started). If an event was saved with the Commitment finished checked, then make it light green (complete).

Updating an event

For now, we won't do that, mostly it is not allowed anyhow. We can always put what is allowed on another page later. Also, events can't be deleted.

Saving in hREA

Save the EconomicEvent, save the Fulfillment, using the same quantities as are on the EconomicEvent, and referencing the EconomicEvent and the Commitment.

If the Commitment finished flag is checked, set Commitment.finished to true.

Affecting EconomicResource

See in VF:

Whenever an EconomicEvent is saved, it should decide if it should also create or update an EconomicResource. First this depends on the action, not all actions have inventoried/instantiated EconomicResources. There is generally a user choice if a resource should be created, but I think for CFN, all resources that can be inventoried will be inventoried. So probably, just the deliverService events won't affect a resource. If we're not keeping track of location (and I don't think we are until we have a real object instead of lat/long), then transportation won't affect the resource either. Except onhandQuantity, but that doesn't seem very important for CFN, so we can skip onhandQuantity.

If all the action data is up to date in hREA, you can do this as a data-driven thing. It is probably not, and we have not very many actions, so let's just do it in logic.

NOTE: Just found an error in the VF doc. Because that event has an implied transfer in it, i.e. it will create a resource for CFN. But the other pickups do not.

LOGIC (updated June 10): We can do limited logic just for them for now. They will have only one resource per resource specification (not true of everyone, and possibly not true of them going into next year if they have inventory). But for now, to see if they have a resource, look for it by resource specification.

  • produce: Always create a resource, primaryAccountable is the provider/receiver agent (should be the same for CFN; later we'll need to check if they are different, so if you want to put that in now, that is fine)
  • consume: Always decrement (subtract the quantity) on the existing resource, no other changes needed
  • pickup: If the provider and receiver are different, then create a new resource, primaryAccountable is the receiver. If they are the same, do nothing about the resource.
  • dropoff: Nothing to do with the resource.
  • deliverService: Doesn't have a resource.
  • transfer: Let's let this one sit for now, we might want to do transfers on the other page.

When creating an EconomicResource, use the following fields:

  • name: use the ResourceSpecification name
  • accountingQuantity: use the event resourceQuantity
  • stage: if it is output of a Process, use the ProcessSpecification of the Process
  • primaryAccountable: the receiver on the event determines that, so it will basically always be CFN (until we get to the last transfer, from CFN to the designers, which is the one in the Satisfy Request column, but we can wait on that until later, I don't think we have the UI for it anyhow)
  • conformsTo: the ResourceSpecification on the resoureConformsTo on the event

When updating an EconomicResource, use:

  • accountingQuantity: see the action chart; or: if produce, increment the resourceQuantity, if Consume, decrement the resourceQuantity, if transfer, decrement the resourceInventoriedAs.resourceQuantity, increment the toResourceInventoriedAs.resourceQuantity (but we're not worrying about transfer yet, that won't matter until the yarn goes to the designers at the end of season)
  • stage: if it is output of a Process, use the ProcessSpecification of the Process