Repository navigation
Read the price a position actually cost off its receipts, and say when nobody wrote one down - #115
Merged
Merged
Conversation
…n nobody wrote one down (#34) Closes #34. Its last open row: price history per position falls out of receiving and must not be a table of typed-in numbers. It falls out of `purchase_receipts.unit_price_paid`, and `contexts/procurement/prices.py` is the read: one query joining receipts to their lines over a window (a year by default) and a pure fold picking each position's earliest and latest priced receipt. Two denominator rules, both tested and both mutation-proved. A receipt with no recorded price is a delivery, not a price of zero: it is counted so the panel can say «приёмок без записанной цены: N», and it moves no figure. A position with one priced receipt has no «было» and no change - null, not 0%, which would claim a year nobody measured. The kit's weighted-average slab is not served; its weights were never chosen. Money, so `GET /purchasing/prices` is behind VIEW_FINANCIALS like `/costs`, and the page never requests it without the permission - the screen test reads the network log, not only what rendered. Verified: 7 unit + 3 API tests plus the existing purchasing API tests pass; three mutations to the fold each fail it (unpriced receipts at zero: 3, trusting input order: 1, single point as a movement: 1). Backend gates all exit=0. Frontend from the lockfile: `tsc --build --force`, lint, test (33 files, 319 passed), build, and a regenerated API client, each exit=0. Co-Authored-By: Claude Fable 5.1 <[email protected]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #34 — its last open row, price history per position falls out of receiving and should not be a separate table of typed-in numbers. The other four rows were built by #96 and #112 (see the status table on the issue).
contexts/procurement/prices.pyis a read overpurchase_receipts.unit_price_paid: one query joining receipts to their lines over a window (365 days by default,?days=), and a pure fold picking each position's earliest and latest priced receipt. Panel «Цены по ключевым позициям» on the purchasing screen.What is deliberately not there, per CLAUDE.md §1
unpriced_receipts, footer «приёмок без записанной цены: N») and moves no figure.earliest = change = null: a price, not a stable price. The kit's «БЫЛО» line draws as a dash there, not0%.Money gate.
GET /purchasing/pricessits behindVIEW_FINANCIALSlike/costs, refused whole.PurchasingPagenever requests it without the permission; the screen test asserts that in the network log.Verified
exit=0. Three mutations to the fold, each run and reverted: unpriced receipts priced at zero (3 tests fail), fold trusting input order (1), single point reported as a movement (1).tsc --build --force,lint,test(33 files, 319 passed) andbuildeachexit=0; the API client regenerated from the new schema and typechecked.🤖 Generated with Claude Code