All checks were successful
Deploy to K8s / deploy (push) Successful in 9s
Replace proportional split with a fill-first loop that allocates min(remaining, deficit) to each matched month in user-supplied order, where deficit = expected - already_paid. Prior transactions' contributions are now properly accounted for, so a second payment on overlapping months fills only what's still owed instead of splitting proportionally by total expected. Surplus after all deficits are covered goes to the credit bucket. Fixes: Matyáš Thér 200+550 showing 566/183 instead of 500/250. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
103 lines
2.3 KiB
JSON
103 lines
2.3 KiB
JSON
{
|
|
"case": "03_proportional_remainder",
|
|
"func": "scripts.match_payments.reconcile",
|
|
"captured_at": "2026-05-11",
|
|
"input": {
|
|
"members": [
|
|
{
|
|
"name": "Member_d035d9f9",
|
|
"tier": "A",
|
|
"fees": {
|
|
"2026-01": [
|
|
750,
|
|
3
|
|
],
|
|
"2026-02": [
|
|
750,
|
|
2
|
|
],
|
|
"2026-03": [
|
|
350,
|
|
2
|
|
]
|
|
}
|
|
}
|
|
],
|
|
"sorted_months": [
|
|
"2026-01",
|
|
"2026-02",
|
|
"2026-03"
|
|
],
|
|
"transactions": [
|
|
{
|
|
"date": "2026-03-10",
|
|
"amount": 800,
|
|
"manual_fix": "",
|
|
"person": "Member_d035d9f9",
|
|
"purpose": "2026-01,2026-02,2026-03",
|
|
"inferred_amount": 800,
|
|
"sender": "Member_d035d9f9",
|
|
"message": "",
|
|
"bank_id": ""
|
|
}
|
|
],
|
|
"exceptions": [],
|
|
"default_year": 2026
|
|
},
|
|
"output": {
|
|
"members": {
|
|
"Member_d035d9f9": {
|
|
"tier": "A",
|
|
"months": {
|
|
"2026-01": {
|
|
"expected": 750,
|
|
"original_expected": 750,
|
|
"attendance_count": 3,
|
|
"exception": null,
|
|
"paid": 750.0,
|
|
"transactions": [
|
|
{
|
|
"amount": 750.0,
|
|
"date": "2026-03-10",
|
|
"sender": "Member_d035d9f9",
|
|
"message": "",
|
|
"confidence": "auto"
|
|
}
|
|
]
|
|
},
|
|
"2026-02": {
|
|
"expected": 750,
|
|
"original_expected": 750,
|
|
"attendance_count": 2,
|
|
"exception": null,
|
|
"paid": 50.0,
|
|
"transactions": [
|
|
{
|
|
"amount": 50.0,
|
|
"date": "2026-03-10",
|
|
"sender": "Member_d035d9f9",
|
|
"message": "",
|
|
"confidence": "auto"
|
|
}
|
|
]
|
|
},
|
|
"2026-03": {
|
|
"expected": 350,
|
|
"original_expected": 350,
|
|
"attendance_count": 2,
|
|
"exception": null,
|
|
"paid": 0,
|
|
"transactions": []
|
|
}
|
|
},
|
|
"other_transactions": [],
|
|
"total_balance": -1050
|
|
}
|
|
},
|
|
"unmatched": [],
|
|
"credits": {
|
|
"Member_d035d9f9": -1050
|
|
}
|
|
}
|
|
}
|