Add a Statistics tab alongside the existing per-ledger tabs (Balance, Transactions, Acquisitions) in ViewLedger.vue. Its initial content is a daily profit view for the ledger, backed by mammon's existing GET /ledgers/{ledgerId}/profit endpoint (DailyProfitResponse[] = { date, iskIn, iskOut, profit }, one entry per day with ISK activity, ascending by date). The tab is framed as a general "Statistics" home so further per-ledger stats can be added later without another tab.
Note: this reframes the original issue. The endpoint that actually exists returns a per-day cash-flow series (profit = iskIn − iskOut), not the FIFO cost-basis / per-item realized-profit view the issue was originally written against. There is no FIFO cost-basis endpoint; that idea is dropped here.
Scope
New Statistics tab + route in ViewLedger.vue and routes.ts, next to the Acquisitions tab:
route name viewLedgerStatistics, path statistics, page ViewLedgerStatistics.vue under pages/ledger/.
Balance stays the default redirect target; no change to existing tabs' order beyond appending Statistics.
Data source: the generated mammon client's GET /ledgers/{ledgerId}/profit. Prerequisite: regenerate gemory/docs/mammon-api.yml and gemory/src/generated/mammon/ from the backend — the endpoint is present in mammon but not yet in the checked-in spec/client. (These are generated files; regenerate, do not hand-edit.)
Render a line chart of profit per day (single series, profit over date), fetched via useLedgerParam + useProcessedResource like the other tabs.
Chart library: introduce Chart.js via vue-chartjs (new npm dependency) — smallest footprint for a single time series.
Show a total profit figure (sum of daily profit) above/beside the chart, using the existing IskLabel.
Combined ledgers: the endpoint returns 400 for combined ledgers ("not supported yet"). Only show the Statistics tab when ledger.type === 'MAIN'; combined ledgers never render the tab and the endpoint is never called for them.
Empty state: when the endpoint returns an empty list (a ledger with no ISK activity), show a "No trade profit recorded for this ledger" message instead of an empty chart; the total shows 0 ISK.
Any FIFO / cost-basis / per-item realized-profit computation or endpoint.
ISK-in / ISK-out or cumulative-equity series, and any per-day data table — profit-per-day line + total only for now.
Additional statistics beyond daily profit (the tab is named to allow them later, but none are built here).
Combined-ledger profit support (blocked on the backend lifting its 400).
Acceptance criteria
A Statistics tab appears in the ledger view for main ledgers and routes to viewLedgerStatistics (statistics); it is absent for combined ledgers.
The tab renders a Chart.js line chart of daily profit for the selected ledger, sourced from GET /ledgers/{ledgerId}/profit via the regenerated mammon client.
A total-profit figure (summed daily profit) is shown via IskLabel.
Empty response renders the empty-state message and a 0 ISK total; combined ledgers never trigger the endpoint.
Component/test coverage consistent with the other ledger tabs.
Related
Backend endpoint already exists: TransactionController#profitPerDayInLedger — GET /ledgers/{ledgerId}/profit in the transaction slice.
Follows the per-ledger Acquisitions tab work (gemory #10).
Same ledger page as gemory #40 (appraised item value on the balance label).
## Summary
Add a **Statistics** tab alongside the existing per-ledger tabs (Balance, Transactions, Acquisitions) in `ViewLedger.vue`. Its initial content is a **daily profit** view for the ledger, backed by mammon's existing `GET /ledgers/{ledgerId}/profit` endpoint (`DailyProfitResponse[]` = `{ date, iskIn, iskOut, profit }`, one entry per day with ISK activity, ascending by date). The tab is framed as a general "Statistics" home so further per-ledger stats can be added later without another tab.
Note: this reframes the original issue. The endpoint that actually exists returns a **per-day cash-flow series** (`profit = iskIn − iskOut`), **not** the FIFO cost-basis / per-item realized-profit view the issue was originally written against. There is no FIFO cost-basis endpoint; that idea is dropped here.
## Scope
- New `Statistics` tab + route in `ViewLedger.vue` and `routes.ts`, next to the Acquisitions tab:
- route name `viewLedgerStatistics`, path `statistics`, page `ViewLedgerStatistics.vue` under `pages/ledger/`.
- Balance stays the default redirect target; no change to existing tabs' order beyond appending Statistics.
- Data source: the generated mammon client's `GET /ledgers/{ledgerId}/profit`. **Prerequisite:** regenerate `gemory/docs/mammon-api.yml` and `gemory/src/generated/mammon/` from the backend — the endpoint is present in mammon but not yet in the checked-in spec/client. (These are generated files; regenerate, do not hand-edit.)
- Render a **line chart of profit per day** (single series, `profit` over `date`), fetched via `useLedgerParam` + `useProcessedResource` like the other tabs.
- Chart library: introduce **Chart.js** via **vue-chartjs** (new npm dependency) — smallest footprint for a single time series.
- Show a **total profit** figure (sum of daily `profit`) above/beside the chart, using the existing `IskLabel`.
- **Combined ledgers:** the endpoint returns 400 for combined ledgers ("not supported yet"). Only show the Statistics tab when `ledger.type === 'MAIN'`; combined ledgers never render the tab and the endpoint is never called for them.
- **Empty state:** when the endpoint returns an empty list (a ledger with no ISK activity), show a "No trade profit recorded for this ledger" message instead of an empty chart; the total shows 0 ISK.
## Out of scope
- Account-wide (all-ledgers) statistics/profit view — per-ledger tab only.
- Any FIFO / cost-basis / per-item realized-profit computation or endpoint.
- ISK-in / ISK-out or cumulative-equity series, and any per-day data table — profit-per-day line + total only for now.
- Additional statistics beyond daily profit (the tab is named to allow them later, but none are built here).
- Combined-ledger profit support (blocked on the backend lifting its 400).
## Acceptance criteria
- [x] A `Statistics` tab appears in the ledger view for **main** ledgers and routes to `viewLedgerStatistics` (`statistics`); it is absent for combined ledgers.
- [x] The tab renders a Chart.js line chart of daily profit for the selected ledger, sourced from `GET /ledgers/{ledgerId}/profit` via the regenerated mammon client.
- [x] A total-profit figure (summed daily profit) is shown via `IskLabel`.
- [x] Empty response renders the empty-state message and a 0 ISK total; combined ledgers never trigger the endpoint.
- [x] Component/test coverage consistent with the other ledger tabs.
## Related
- Backend endpoint already exists: `TransactionController#profitPerDayInLedger` — `GET /ledgers/{ledgerId}/profit` in the `transaction` slice.
- Follows the per-ledger Acquisitions tab work (gemory #10).
- Same ledger page as gemory #40 (appraised item value on the balance label).
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
Summary
Add a Statistics tab alongside the existing per-ledger tabs (Balance, Transactions, Acquisitions) in
ViewLedger.vue. Its initial content is a daily profit view for the ledger, backed by mammon's existingGET /ledgers/{ledgerId}/profitendpoint (DailyProfitResponse[]={ date, iskIn, iskOut, profit }, one entry per day with ISK activity, ascending by date). The tab is framed as a general "Statistics" home so further per-ledger stats can be added later without another tab.Note: this reframes the original issue. The endpoint that actually exists returns a per-day cash-flow series (
profit = iskIn − iskOut), not the FIFO cost-basis / per-item realized-profit view the issue was originally written against. There is no FIFO cost-basis endpoint; that idea is dropped here.Scope
Statisticstab + route inViewLedger.vueandroutes.ts, next to the Acquisitions tab:viewLedgerStatistics, pathstatistics, pageViewLedgerStatistics.vueunderpages/ledger/.GET /ledgers/{ledgerId}/profit. Prerequisite: regenerategemory/docs/mammon-api.ymlandgemory/src/generated/mammon/from the backend — the endpoint is present in mammon but not yet in the checked-in spec/client. (These are generated files; regenerate, do not hand-edit.)profitoverdate), fetched viauseLedgerParam+useProcessedResourcelike the other tabs.profit) above/beside the chart, using the existingIskLabel.ledger.type === 'MAIN'; combined ledgers never render the tab and the endpoint is never called for them.Out of scope
Acceptance criteria
Statisticstab appears in the ledger view for main ledgers and routes toviewLedgerStatistics(statistics); it is absent for combined ledgers.GET /ledgers/{ledgerId}/profitvia the regenerated mammon client.IskLabel.Related
TransactionController#profitPerDayInLedger—GET /ledgers/{ledgerId}/profitin thetransactionslice.Add a Trade Profit tab to the ledger viewto Add a Statistics tab to the ledger view