use oldest instead of group[0]

This commit is contained in:
2024-05-18 20:00:33 +02:00
parent ff4c9c6bf0
commit 52a4b99214

View File

@@ -55,13 +55,13 @@ const { sortedArray, headerProps } = useSort<Result>(computed(() => {
const total = group.reduce((acc, r) => acc + r.quantity, 0);
const totalRemaining = group.reduce((acc, r) => acc + r.remaining, 0);
const price = group.reduce((acc, r) => acc + r.price * r.remaining, 0) / totalRemaining;
const precentProfit = marketTaxStore.calculateProfit(price, group[0].sell);
const precentProfit = marketTaxStore.calculateProfit(price, oldest.sell);
list.push({
type: oldest,
typeID: type.id,
name: type.name,
buy: group[0].buy,
sell: group[0].sell,
buy: oldest.buy,
sell: oldest.sell,
price: price,
remaining: totalRemaining,
quantity: total,