Skip to content

Show previous-period percentage changes in summary cards#42

Merged
andrewzolotukhin merged 1 commit into
mainfrom
feat/period-change-percentages
Jun 14, 2026
Merged

Show previous-period percentage changes in summary cards#42
andrewzolotukhin merged 1 commit into
mainfrom
feat/period-change-percentages

Conversation

@andrewzolotukhin

@andrewzolotukhin andrewzolotukhin commented Jun 14, 2026

Copy link
Copy Markdown
Contributor

Original request

Add previous-period percentage changes for the Income, Expenses, and Net totals at the top of the dashboard, vendors, and reports pages, using appropriate colors so the current period can be compared quickly with the previous period.

What changed

  • Extended the dashboard summary contract with comparison.previousPeriod totals for income, expenses, and net.
  • Populated dashboard comparison totals from the previous-period rows already loaded by the dashboard summary aggregation.
  • Added shared web formatting helpers for previous-period percent change labels and semantic coloring.
  • Updated the shared dashboard summary cards used by dashboard and vendors to show percentage change below each total.
  • Updated reports stats cards to keep their existing absolute previous-period and previous-year deltas while adding previous-period percentage changes for Income, Expenses, and Net.
  • Added focused tests for API aggregation, contract validation, formatting helpers, dashboard summary cards, and reports stats cards.

Reasoning

The dashboard endpoint already fetched previous-period rows for category comparisons, so exposing summary-level comparison totals avoids adding another query. The reports page already had richer comparison lines, so the implementation preserves that context and adds the requested percentage next to the existing previous-period delta. Expense percentages use the existing category convention: higher expenses are red, lower expenses are green.

Screenshots / preview evidence

Preview URL: https://xpenser-pr-042.cleverbrush.com

Manual QA was performed with the seeded preview account. Screenshots were captured locally by agent-browser:

  • Dashboard: /tmp/xpenser-pr42-dashboard.png
  • Vendors: /tmp/xpenser-pr42-vendors.png
  • Reports: /tmp/xpenser-pr42-reports.png

Observed behavior:

  • Dashboard shows previous-period percentages for Income, Expenses, and Net.
  • Vendors shows the same shared summary-card percentages.
  • Reports keeps the existing absolute previous-period and previous-year deltas, and adds previous-period percentages for Income, Expenses, and Net only.

Validation

Local validation:

  • npm run lint passed
  • npm run typecheck passed
  • npm test passed

GitHub checks:

  • Lint and test passed
  • Deploy PR environment passed
  • Playwright e2e passed

Preview QA:

  • Signed in at https://xpenser-pr-042.cleverbrush.com with the seeded preview account.
  • Verified /dashboard, /vendors, and /stats render the requested percentage changes.

SigNoz:

  • Logs: xpenser-web-pr-42 and xpenser-api-pr-42 both had 0 ERROR logs in the last hour.
  • Traces: xpenser-web-pr-42 and xpenser-api-pr-42 both had 0 error traces in the last hour.
  • Service telemetry: xpenser-web-pr-42 showed 888 calls and xpenser-api-pr-42 showed 455 calls in the last hour, both with 0 errors.
  • Top operations for dashboard, vendors, stats, and dashboard/stats window endpoints showed errorCount: 0.
  • Metrics note: SigNoz metric resource values include xpenser-api-pr-42, but http.server.duration.count returned no recent rows for the PR services, and no web service.name metric value was present. Logs, traces, and service telemetry were clean.

@andrewzolotukhin andrewzolotukhin temporarily deployed to pr-42 June 14, 2026 00:28 — with GitHub Actions Inactive
@andrewzolotukhin andrewzolotukhin merged commit b466e7f into main Jun 14, 2026
4 checks passed
@andrewzolotukhin andrewzolotukhin deleted the feat/period-change-percentages branch June 14, 2026 00:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant