cleanup acquisitions
This commit is contained in:
@@ -44,10 +44,10 @@ const marketTaxStore = useMarketTaxStore();
|
||||
const threshold = useStorage('market-acquisition-threshold', 10);
|
||||
const filter = ref("");
|
||||
const { sortedArray, headerProps } = useSort<Result>(computed(() => {
|
||||
const filteredItems = props.items.filter(r => r.type.name.toLowerCase().includes(filter.value.toLowerCase()));
|
||||
|
||||
if (props.showAll) {
|
||||
return props.items
|
||||
.filter(r => r.type.name.toLowerCase().includes(filter.value.toLowerCase()))
|
||||
.map(r => {
|
||||
return filteredItems.map(r => {
|
||||
const precentProfit = marketTaxStore.calculateProfit(r.price, r.sell);
|
||||
|
||||
return {
|
||||
@@ -66,7 +66,7 @@ const { sortedArray, headerProps } = useSort<Result>(computed(() => {
|
||||
}
|
||||
|
||||
const list: Result[] = [];
|
||||
const groups = Map.groupBy(props.items.filter(r => r.type.name.toLowerCase().includes(filter.value.toLowerCase())), r => r.type);
|
||||
const groups = Map.groupBy(filteredItems, r => r.type);
|
||||
|
||||
groups.forEach((group, type) => {
|
||||
const oldest = group.reduce((acc: AcquiredType | undefined, r: AcquiredType) => (acc && acc.date < r.date) ? acc : r, undefined);
|
||||
|
||||
Reference in New Issue
Block a user