Skip to content

Replace ProductAverageRevenueTable with TopProductsTable using direct transaction aggregation#49

Open
IanTheMitten wants to merge 1 commit into
mainfrom
codex/replace-productaveragerevenuetable-with-topproductstable
Open

Replace ProductAverageRevenueTable with TopProductsTable using direct transaction aggregation#49
IanTheMitten wants to merge 1 commit into
mainfrom
codex/replace-productaveragerevenuetable-with-topproductstable

Conversation

@IanTheMitten

Copy link
Copy Markdown
Owner

Motivation

  • Simplify the statistics view to aggregate metrics directly from sampled transactions and remove reliance on inventory-adjustment replay and product adjustments API calls.
  • Surface actionable per-product metrics (rank, units, revenue, profit, margin) with a straightforward revenue-first ranking and optional secondary sorting.

Description

  • Added src/components/statistic/TopProductsTable.tsx, which aggregates unitsSold, revenue, and profit from sampled transactions and computes margin as profit / revenue with a divide-by-zero guard.
  • Default sorting is by revenue descending and the table includes optional secondary sort controls (metric + direction) for tie-breaking or alternate views.
  • Removed src/components/statistic/ProductAverageRevenueTable.tsx and its inventory-adjustment replay and API dependency, and updated StatisticPage and App to use the new TopProductsTable signature.
  • Rendered columns: Rank, Product, Units Sold, Revenue, Profit, Margin % and preserved sampled-day filtering via the existing sampling utilities.

Testing

  • Ran npm run build and the production build completed successfully with no errors.

Codex Task

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant