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