Loans: show principal and interest paid so far
Merged
DA
1d ago+573+573+012345678901234567890123456789-24-24-01234567890123456789
Follow-up to #4470 (merged), which introduced the principal/interest replay and the split loan balance. That PR is the base this one builds on; this PR only adds the Paid so far card and the read-path change it needs.
What changed
- Paid so far card. Shows cumulative principal and interest through the Overview's reference date, with their shares and the combined total.
- Same replay. Uses
Loan::PrincipalPaymentsfrom #4470, so the card and the balance describe the same loan. A loan without a replay falls back to the latest recorded balance on or before the date (or a current anchor on that date) plus the scheduled interest. That interest is marked as estimated, because the schedule says what is due, not what was paid. - Read path.
Balance::SyncCacheacceptsreport_missing_rates: false. The paid card is its production caller: it builds the replay while the page renders and must not writeDebugLogEntryrows for data the next sync will inspect. A test renders with an unconvertible entry and asserts no diagnostic is written. - No empty card. The card is hidden when nothing has been paid.
- Grid. Two cards use two columns and three cards use three, so no empty slot is left.
- Visibility. The card is rendered only for users with preview features on; the data itself is gated by the family flag on the balance side.
- French and English labels for the new strings.
The card itself adds no migrations and no balance changes.
Validation
- Full Rails suite: 15,874 runs, 102,750 assertions, 0 failures, 0 errors, 9 skips
- Loan overview and payoff-chart system tests: 15 runs, 195 assertions, 0 failures
- RuboCop: clean on changed files
- ERB lint: clean
- Brakeman: 0 warnings
- View tests cover the paid card, the hidden empty card, the per-user preview gate, the estimated-interest note and the two-/three-column layout
Summary by CodeRabbit
- New Features
- Loan repayment progress can show principal and interest paid to date, with a clear label when interest is estimated from the payment schedule.
- The paid-so-far breakdown reflects payments through the selected date and appears only when preview features are enabled and there is an amount to display.
- Repayment cards adjust their layout to the number of available sections, keeping the progress view organized across different loan details.