Show an appraised estimate of held items on the ledger balance label #40

Closed
opened 2026-07-25 14:45:59 +02:00 by Sirttas · 0 comments
Owner

Summary

On the ledger page header (ViewLedger.vue), the balance label currently shows only the ledger's ISK balance (IskLabel :amount="ledger.balance"). Add an appraised estimate of the items held in the ledger as a second, separate figure beside/under the existing ISK balance, so the header reflects both liquid ISK and inventory value. The existing ISK balance keeps its current meaning and display — this is purely additive.

Scope

  • In ViewLedger.vue, fetch the ledger's held items via getLedgerBalance(ledgerId)BalanceResponse.itemBalances ({ typeId, quantity }). This fetch lives in the header component; the Balance tab (ViewLedgerBalance.vue) keeps its own independent fetch unchanged.
  • Resolve the held type ids to MarketTypes (getMarketTypes) and appraise via the market prices path (getPrices(types) from @/market/appraisal), which returns { buy, sell, orderCount } per type. Price at Jita (call with no locationId — the endpoint defaults to Jita).
  • Compute both a buy total and a sell total: Σ quantity × buy and Σ quantity × sell across the held stacks. Render both in the header (e.g. ~305M buy / ~340M sell), reusing IskLabel for formatting.
  • Behaviour applies to both main and combined ledgers — the balance endpoint returns itemBalances for any ledger id and the header is shared, so use one code path with no isMain branching.

Edge cases

  • No items (empty itemBalances, or both totals resolve to 0): do not render the item figure at all — show only the ISK balance.
  • Partial / failed price lookups: best-effort — sum only the stacks that resolved to a price and ignore the rest. No error UI.

Explicitly out of scope

  • Any new or changed mammon endpoint — the existing balance + market prices endpoints are sufficient; frontend-only change.
  • Combining ISK and item value into a single "total worth" number — the two are shown as distinct figures.
  • A location picker / per-ledger pricing location — Jita is fixed for now; configurability can be a later issue.
  • Per-item valuation UI — the Balance tab already lists items; this issue is only the aggregate on the header label.

Acceptance criteria

  • The ledger header shows an appraised item estimate as a separate figure alongside the existing ISK balance, for both main and combined ledgers.
  • The estimate shows both a buy total and a sell total, computed as Σ quantity × unit price from BalanceResponse.itemBalances × getPrices(types) at Jita, formatted with IskLabel.
  • The item figure is hidden when there are no held items / both totals are 0; partial price failures sum only the resolved stacks with no error UI.
  • The estimate updates with the selected ledger.
  • Component/test coverage consistent with the ledger page.

Related

  • Same ledger page as gemory #39 (Statistics tab).
## Summary On the ledger page header (`ViewLedger.vue`), the balance label currently shows only the ledger's ISK balance (`IskLabel :amount="ledger.balance"`). Add an **appraised estimate of the items held in the ledger** as a second, separate figure beside/under the existing ISK balance, so the header reflects both liquid ISK and inventory value. The existing ISK balance keeps its current meaning and display — this is purely additive. ## Scope - In `ViewLedger.vue`, fetch the ledger's held items via `getLedgerBalance(ledgerId)` → `BalanceResponse.itemBalances` (`{ typeId, quantity }`). This fetch lives in the header component; the Balance tab (`ViewLedgerBalance.vue`) keeps its own independent fetch unchanged. - Resolve the held type ids to `MarketType`s (`getMarketTypes`) and appraise via the market prices path (`getPrices(types)` from `@/market/appraisal`), which returns `{ buy, sell, orderCount }` per type. Price at **Jita** (call with no `locationId` — the endpoint defaults to Jita). - Compute **both** a buy total and a sell total: `Σ quantity × buy` and `Σ quantity × sell` across the held stacks. Render both in the header (e.g. `~305M buy / ~340M sell`), reusing `IskLabel` for formatting. - Behaviour applies to **both main and combined** ledgers — the balance endpoint returns `itemBalances` for any ledger id and the header is shared, so use one code path with no `isMain` branching. ## Edge cases - **No items** (empty `itemBalances`, or both totals resolve to 0): do not render the item figure at all — show only the ISK balance. - **Partial / failed price lookups**: best-effort — sum only the stacks that resolved to a price and ignore the rest. No error UI. ## Explicitly out of scope - Any new or changed mammon endpoint — the existing balance + market prices endpoints are sufficient; frontend-only change. - Combining ISK and item value into a single "total worth" number — the two are shown as distinct figures. - A location picker / per-ledger pricing location — Jita is fixed for now; configurability can be a later issue. - Per-item valuation UI — the Balance tab already lists items; this issue is only the aggregate on the header label. ## Acceptance criteria - [x] The ledger header shows an appraised item estimate as a separate figure alongside the existing ISK balance, for both main and combined ledgers. - [x] The estimate shows both a buy total and a sell total, computed as `Σ quantity × unit price` from `BalanceResponse.itemBalances` × `getPrices(types)` at Jita, formatted with `IskLabel`. - [x] The item figure is hidden when there are no held items / both totals are 0; partial price failures sum only the resolved stacks with no error UI. - [x] The estimate updates with the selected ledger. - [x] Component/test coverage consistent with the ledger page. ## Related - Same ledger page as gemory #39 (Statistics tab).
Sirttas added the Kind/Enhancement
Status
To Refine
Priority
Low
4
labels 2026-07-25 14:45:59 +02:00
Sirttas removed the
Status
To Refine
label 2026-07-26 17:35:36 +02:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: eveal/gemory#40