Files
fuj-management/CHANGELOG.md
Jan Novak dfdf2aacb8
All checks were successful
Build and Push / build (push) Successful in 33s
Deploy to K8s / deploy (push) Successful in 12s
fix: Distribute multi-month payments by per-month expected fee
reconcile() previously split a multi-month payment evenly across months,
which falsely flagged months as underpaid when their expected fees
differed (e.g. 1250 CZK for 02+03+04 2026 with rates 750/350/150 was
shown as 416/month with two months red).

The allocation now runs per matched member: greedy when the share covers
the total expected (each month gets its expected fee, surplus -> credit),
proportional by expected fee otherwise. Out-of-window months keep the
previous even-split-to-credit behavior. 6 new test cases.

Also adds CHANGELOG.md and a changelog convention in CLAUDE.md.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-03 19:38:10 +02:00

948 B

Changelog

2026-05-03 19:26 CEST — Fee-aware allocation for multi-month payments

  • reconcile() no longer splits a multi-month payment evenly. Allocation is now per-member with two phases: greedy (if amount ≥ total expected, each month gets exactly its expected fee and overflow → credit) and proportional (otherwise distribute by each month's expected). Fixes the case where e.g. 1250 CZK covering 3 months with mixed fees (750/350/150) marked two months red.
  • Out-of-window months keep the previous even-split-to-credit behavior. Fallback to even split when all matched months have expected = 0 (prepayment before attendance is recorded).
  • Display layer only — no changes to how payments are stored in Google Sheets; Inferred Amount still holds the full bank amount.
  • Files: scripts/match_payments.py, tests/test_reconcile_exceptions.py (6 new test cases).