human-essentials icon indicating copy to clipboard operation
human-essentials copied to clipboard

Add dated pricing of items

Open cielf opened this issue 3 years ago • 6 comments

Summary

Add historical pricing

Justification

“Price changes have been propagated backward (into old transactions), making them inaccurate”

Prices are currently tied directly to items. Alas, we live in a world where prices change. The banks need to have the historical values of transactions (e.g. distributions) be accurate, and they currently are not, because the prices are tied directly to the items, and the value of the transactions is the sum of (item_price * number of items)

Details

We need to add the ability to have price changes on items that only effect the price from the effective date of that price change forward. This needs to be reflected anywhere that we use item prices that has a date associated with it.

FOR DISCUSSION

We could just calculate the price and store it with the relevant transaction. I (CL) think that's going to cause us trouble if there are any adjustments after a price change. Also, it won't solve the problem of the transactions that have already occured.

Instead, I think we should store historical pricing for each item. Allow dated price updates Transactions would use the prices that are in effect as of the transaction date. [Future distribution values would be the current price]

Discussion in the 20220331 hours: We probably really need to store it in both places -- and update the price on the transaction if there are adjustments or new historical pricing added. (the work will be on write rather than read)

Discussion in the 20220806 Alternate ideas:
Have a pricing record -- date and a json blob of all the prices at that date or on each item record have a tuples of {date, price}

Discussion in 20220918 meeting

  • store the prices as a sorted-by date array?.
  • need to be able to press a button and see the histo

Things we need to know

  • Sounds like a good thing for the R4G event

Criteria for completion

  • [ ] Add tests for historical pricing
  • [ ] Add historical pricing - ability to set prices on items (including post-dated)
  • [ ] Adapt that all transactions (e.g. distributions, purchases, donations) [#TODO Am I missing anything? ] show the correct prices

cielf avatar Jul 25 '22 18:07 cielf

Captura de Pantalla 2022-09-18 a la(s) 10 41 58 a m

Notes!

edwinthinks avatar Sep 18 '22 15:09 edwinthinks

The gnarly question we left off on is, more or less, how do we handle entering initial prices versus price updates, trying to make both as easy and clear as possible for the end-user (while still being sane for us). Hoping to pick up the discussion at the September 25 office hours.

cielf avatar Sep 18 '22 15:09 cielf

Noting that no one has mentioned it in the Stakeholder Circle for quite some time now. Maybe we should put this as "Won't do" for now.

cielf avatar Jun 10 '23 13:06 cielf

@dorner points out that you kind of get this for free if you're doing event sourcing.

cielf avatar Jul 30 '23 14:07 cielf