From 3b9d302ce214087a45df413eafe20fbbfde9cc1c Mon Sep 17 00:00:00 2001 From: siddharthd Date: Tue, 28 Jul 2026 13:02:56 +1000 Subject: [PATCH] docs(shared): record the grouped-payment allocation Sonu's two "transfer" payments are split by scope, Europe first and the remainder to household, chronologically so each settles what was outstanding when it was made. Both Europe tabs now read $0.00. No schema change was needed and that is the point worth writing down: split_payments has no unique constraint on linked_transaction_id, so one bank transfer carries one row per scope and the rows re-add to the transfer -- verified, 4111 sums to $3,779.33 and 4121 to $4,794.06. Her overall balance is unchanged at $5,428.08. Allocation moves money between tabs, never between people; that invariance is the check to repeat on any future re-allocation. --- docs/shared-expenses-design.md | 30 +++++++++++++++++++++--------- 1 file changed, 21 insertions(+), 9 deletions(-) diff --git a/docs/shared-expenses-design.md b/docs/shared-expenses-design.md index ec0c09a..9dd9ad9 100644 --- a/docs/shared-expenses-design.md +++ b/docs/shared-expenses-design.md @@ -203,15 +203,7 @@ fortnight of principal into spend, the error migration 0014 exists to prevent. marks Molina's money in all six known cases, but it is a description match on a free-text field. Acceptable as a *suggestion* requiring confirmation, not as an automatic rule. -3. **Two unattributable Sonu payments.** #3 ($3,779.33, 12 Apr) and #8 - ($4,794.06, 16 May) are narrated only as "transfer", and payments are made - grouped — one transfer can cover a trip and the household tab together. That - is already expressible: `split_payments` has no unique constraint on - `linked_transaction_id`, so one bank transfer can carry several rows, each - with its own `trip_id`. What is missing is the breakdown. Both currently sit - whole on the household tab; splitting them moves money between tabs without - changing her overall balance. -4. **The solo leg.** A Qantas booking on 23 Apr (txn 2849, $1,366.40) is the +3. **The solo leg.** A Qantas booking on 23 Apr (txn 2849, $1,366.40) is the flight to Bangkok that begins a solo leg, and the Singapore spending ($2,242.05, 40 rows, to 9 May) is solo — not shared. It has no trip record. Worth one if trip *cost* is wanted for it; nothing about sharing depends on @@ -224,3 +216,23 @@ fortnight of principal into spend, the error migration 0014 exists to prevent. invisible to trip analytics. Includes one advance booking on 17 Mar (Ticketmaster Nanterre) and the 12 Apr handover-day rows, which were already held out of Europe 2026. + +- **Grouped payments, split by scope.** Payments are made grouped — one transfer + covers several tabs — and that needs no schema change, because + `split_payments` has no unique constraint on `linked_transaction_id`. So one + bank transfer carries one row per scope, and the rows re-add to the transfer. + + Sonu's two "transfer" payments were allocated Europe-first, remainder to + household, chronologically so each settles what was outstanding when it was + made: + + | Transfer | Scope | Amount | + |---|---|---:| + | $3,779.33, 12 Apr (txn 4111) | Europe 2026 | 1,084.61 | + | | Europe — Sonu + Sunny | 2,694.72 | + | $4,794.06, 16 May (txn 4121) | Europe — Sonu + Sunny | 1,145.52 | + | | household | 3,648.54 | + + Both Europe tabs now read $0.00 and her overall balance is unchanged at + $5,428.08 — allocation moves money between tabs, never between people. That + invariance is the check worth repeating on any future re-allocation.