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 total = group.reduce((acc, r) => acc + r.quantity, 0);
|
||||||
const totalRemaining = group.reduce((acc, r) => acc + r.remaining, 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 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({
|
list.push({
|
||||||
type: oldest,
|
type: oldest,
|
||||||
typeID: type.id,
|
typeID: type.id,
|
||||||
name: type.name,
|
name: type.name,
|
||||||
buy: group[0].buy,
|
buy: oldest.buy,
|
||||||
sell: group[0].sell,
|
sell: oldest.sell,
|
||||||
price: price,
|
price: price,
|
||||||
remaining: totalRemaining,
|
remaining: totalRemaining,
|
||||||
quantity: total,
|
quantity: total,
|
||||||
|
|||||||
Reference in New Issue
Block a user