fix scan
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
<script setup lang="ts">
|
||||
import {getMarketTypes, TaxInput, useApraisalStore, useMarketTaxStore} from "@/market";
|
||||
import {getMarketTypes, TaxInput, useMarketTaxStore} from "@/market";
|
||||
import {BuyModal} from '@/market/acquisition';
|
||||
import {ScanResult, ScanResultTable, toScanResult} from '@/market/scan';
|
||||
import {marketApi} from "@/mammon";
|
||||
@@ -8,7 +8,6 @@ import {ref, watch} from 'vue';
|
||||
|
||||
const buyModal = ref<typeof BuyModal>();
|
||||
|
||||
const apraisalStore = useApraisalStore();
|
||||
const marketTaxStore = useMarketTaxStore();
|
||||
const days = useStorage('market-scan-days', 365);
|
||||
const items = ref<ScanResult[]>([]);
|
||||
@@ -23,13 +22,11 @@ const scan = async () => {
|
||||
marketTaxStore.scc / 100
|
||||
);
|
||||
const types = await getMarketTypes(data.map(r => r.marketTypeId));
|
||||
const prices = await apraisalStore.getPrices(types);
|
||||
|
||||
items.value = data.flatMap(r => {
|
||||
const type = types.find(t => t.id === r.marketTypeId);
|
||||
const price = prices.find(p => p.type.id === r.marketTypeId);
|
||||
|
||||
return type && price ? [toScanResult(r, type, price)] : [];
|
||||
return type ? [toScanResult(r, type)] : [];
|
||||
});
|
||||
} finally {
|
||||
loading.value = false;
|
||||
|
||||
Reference in New Issue
Block a user