use oldest instead of group[0]
This commit is contained in:
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user