Improve Settle up avatars and amount prefilling #4

Merged
exler merged 2 commits from feat/issue-3 into main 2026-10-22 22:39:23 +02:00
Collaborator

Summary

Closes #3.

  • Show avatars in both payer and receiver lists, with initial fallbacks and guest labels.
  • Prefill suggested amounts when selecting a receiver and refresh automatic suggestions when changing the payer, while preserving manually edited amounts.
  • Keep valid selections, amount and currency after a failed submit.
  • Format label amounts with Intl.NumberFormat, preserving the currency formatting introduced in main, and reset to the group base currency when applying a suggestion.
  • Use safe JSON serialization and fix the stray percent sign / missing Polish translations in balance labels.

Upstream integration

Merged 4c5968e15c86aa7638bb14781ffe8b16bc8f2b1d into this branch without rewriting history. Preserved money(v) / Intl.NumberFormat for labels and the PR's translate-tag fix for EN/PL placeholders. Amount inputs remain raw decimals. Re-ran all 188 tests, changed-file lint, and all 23 browser interaction checks after reconciliation.

Root cause and approach

The settlement picker previously rendered names only. Its partial suggestion logic cleared the amount on payer changes and discarded all form state on validation errors. Shared server-rendered member rows now reuse the existing avatar style; Alpine updates only automatically suggested amounts. Names remain Django-escaped rather than interpolated into JavaScript.

Verification

  • uv sync --frozen.
  • uv run pytest -q: 188 passed (including avatar, escaping, invalid submission and EN/PL label regressions).
  • uv run ruff check expenses/views.py tests/test_expenses.py tests/test_i18n.py: passed.
  • git diff --check: passed.
  • 23 real Chromium/Alpine interaction checks passed on fixture-rendered responses from the actual Django route: avatars, guests, suggestions, payer changes, currency reset, manual edits, escaping and invalid POST restoration.
  • Updated desktop capture at 1280px after merging main; 420px mobile layout probe showed no horizontal overflow. A fresh mobile screenshot capture timed out, so the obsolete mobile image was removed.

Limits / risk

  • Browser evidence uses synthetic local data, not a production login or a live submission.
  • Existing mypy debt remains (86 errors on both the base and implementation, checked during implementation); this is not a claim of a clean typecheck.
  • Pytest emits the existing missing staticfiles/ warning under test storage settings.
  • No automated PR checks are configured: the existing workflow publishes Docker only on main/tag pushes. Browser checks were run as disposable QA, not committed as a parallel harness.
  • No schema changes or deployment. Manual settlement amounts remain editable; non-debtor payers receive no automatic suggestion.

Visual verification

Fixture-rendered Django route with synthetic local members; real Alpine.js interactions, no production account.
desktop-prefilled

## Summary Closes #3. - Show avatars in both payer and receiver lists, with initial fallbacks and guest labels. - Prefill suggested amounts when selecting a receiver and refresh automatic suggestions when changing the payer, while preserving manually edited amounts. - Keep valid selections, amount and currency after a failed submit. - Format label amounts with `Intl.NumberFormat`, preserving the currency formatting introduced in main, and reset to the group base currency when applying a suggestion. - Use safe JSON serialization and fix the stray percent sign / missing Polish translations in balance labels. ## Upstream integration Merged `4c5968e15c86aa7638bb14781ffe8b16bc8f2b1d` into this branch without rewriting history. Preserved `money(v)` / `Intl.NumberFormat` for labels and the PR's translate-tag fix for EN/PL placeholders. Amount inputs remain raw decimals. Re-ran all 188 tests, changed-file lint, and all 23 browser interaction checks after reconciliation. ## Root cause and approach The settlement picker previously rendered names only. Its partial suggestion logic cleared the amount on payer changes and discarded all form state on validation errors. Shared server-rendered member rows now reuse the existing avatar style; Alpine updates only automatically suggested amounts. Names remain Django-escaped rather than interpolated into JavaScript. ## Verification - `uv sync --frozen`. - `uv run pytest -q`: **188 passed** (including avatar, escaping, invalid submission and EN/PL label regressions). - `uv run ruff check expenses/views.py tests/test_expenses.py tests/test_i18n.py`: passed. - `git diff --check`: passed. - **23 real Chromium/Alpine interaction checks passed** on fixture-rendered responses from the actual Django route: avatars, guests, suggestions, payer changes, currency reset, manual edits, escaping and invalid POST restoration. - Updated desktop capture at 1280px after merging main; 420px mobile layout probe showed no horizontal overflow. A fresh mobile screenshot capture timed out, so the obsolete mobile image was removed. ## Limits / risk - Browser evidence uses synthetic local data, not a production login or a live submission. - Existing mypy debt remains (86 errors on both the base and implementation, checked during implementation); this is not a claim of a clean typecheck. - Pytest emits the existing missing `staticfiles/` warning under test storage settings. - No automated PR checks are configured: the existing workflow publishes Docker only on main/tag pushes. Browser checks were run as disposable QA, not committed as a parallel harness. - No schema changes or deployment. Manual settlement amounts remain editable; non-debtor payers receive no automatic suggestion. ## Visual verification Fixture-rendered Django route with synthetic local members; real Alpine.js interactions, no production account. ![desktop-prefilled](https://git.marut.network/attachments/0adf57d3-1278-40a1-85c7-efdb750a9efb)
exler merged commit 4b7bbb538f into main 2026-10-22 22:39:23 +02:00
exler deleted branch feat/issue-3 2026-10-22 22:39:23 +02:00
Sign in to join this conversation.
No reviewers
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
exler/spendbee!4
No description provided.