Carbon-Farm-Network / app-carbon-farm-network

GNU Affero General Public License v3.0
1 stars 0 forks source link

Costs not calculating correctly from recipe #118

Closed fosterlynn closed 3 months ago

fosterlynn commented 3 months ago

When the plan is first created from recipe, the costs are not calculating correctly. I think (but will calc a few by hand and make sure) they are calculating correctly when the commitment is edited and the cost box checked.

Screenshot from 2024-05-21 06-50-52

Looks like the quantities (the pounds) are calculating correctly on the services, will double check.

So what seems to be missing is multiplying the calculated quantity by the quantity in the offer - use the resourceQuantity in the primary intent, not the reciprocal one (that could be the problem). (If there is no offer, use the quantity in the recipe, but don't worry about that now, because we will have all the recipes.)

Stepping back and looking at the results, for example in the screen shot above, looking at the Shipping Service, it found the right offer because it has the provider agent, and it calculated the pounds correctly (377), but then should have multiplied it by the offer's reciprocal intent quantity, which in this case is $1, result displayed s/be $377.

Another example, looking at the white alpaca scouring (first one), the pounds calculated correctly (SumInputs). The offer is $150/lb, the cost should be $1.50 * 59.

fosterlynn commented 3 months ago

fixed!