Acquisition table shows NaN/Infinity profit when bought price is 0 #44

Open
opened 2026-07-29 20:31:45 +02:00 by Sirttas · 0 comments
Owner

Summary

In AcquisitionResultTable.vue, rows with a bought price of 0 (e.g. manufactured or looted
items with no purchase cost) show broken profit values instead of a real profit.

Steps to reproduce

  1. Have an acquisition row with price === 0 and a non-zero sell price.
  2. Look at the Profit (%) and Profit (ISK) columns for that row.

Expected

A 0 bought price should be treated as full profit relative to the sell price (or otherwise a
sane, finite number), and the row should sort/color (profit threshold) correctly.

Actual

  • useMarketTaxStore.calculateProfit(buy, sell) = (applyTaxes(sell, true) / applyTaxes(buy)) - 1.
    When buy is 0, applyTaxes(buy) is 0, so this divides by zero → Infinity.
  • iskProfit is computed as r.price * precentProfit * r.remaining (AcquisitionResultTable.vue),
    i.e. 0 * Infinity * remainingNaN.
  • Percent Profit column shows Infinity%, ISK Profit column shows NaN, and the profit-threshold
    color/sort logic (result.precentProfit >= threshold, < 0) behaves unpredictably against
    Infinity/NaN.

Notes

  • calculateProfit lives in src/market/tax/tax.ts; iskProfit is computed independently in
    AcquisitionResultTable.vue in three places (market/acquisition/AcquisitionResultTable.vue:98,132
    and the totals row at :169) — a fix needs to be consistent across all three, or centralized.
## Summary In `AcquisitionResultTable.vue`, rows with a bought price of 0 (e.g. manufactured or looted items with no purchase cost) show broken profit values instead of a real profit. ## Steps to reproduce 1. Have an acquisition row with `price === 0` and a non-zero sell price. 2. Look at the Profit (%) and Profit (ISK) columns for that row. ## Expected A 0 bought price should be treated as full profit relative to the sell price (or otherwise a sane, finite number), and the row should sort/color (profit threshold) correctly. ## Actual - `useMarketTaxStore.calculateProfit(buy, sell)` = `(applyTaxes(sell, true) / applyTaxes(buy)) - 1`. When `buy` is 0, `applyTaxes(buy)` is 0, so this divides by zero → `Infinity`. - `iskProfit` is computed as `r.price * precentProfit * r.remaining` (`AcquisitionResultTable.vue`), i.e. `0 * Infinity * remaining` → `NaN`. - Percent Profit column shows `Infinity%`, ISK Profit column shows `NaN`, and the profit-threshold color/sort logic (`result.precentProfit >= threshold`, `< 0`) behaves unpredictably against `Infinity`/`NaN`. ## Notes - `calculateProfit` lives in `src/market/tax/tax.ts`; `iskProfit` is computed independently in `AcquisitionResultTable.vue` in three places (`market/acquisition/AcquisitionResultTable.vue:98,132` and the totals row at `:169`) — a fix needs to be consistent across all three, or centralized.
Sirttas added the
Status
To Refine
Kind/Bug
Priority
Medium
3
labels 2026-07-29 20:31:45 +02:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: eveal/gemory#44