diff --git a/src/reprocess/ReprocessResultTable.vue b/src/reprocess/ReprocessResultTable.vue index 18457d6..50ee9da 100644 --- a/src/reprocess/ReprocessResultTable.vue +++ b/src/reprocess/ReprocessResultTable.vue @@ -16,24 +16,32 @@ const props = withDefaults(defineProps(), { }); const threshold = useStorage('reprocess-threshold', 0); -const useSellOrder = useStorage('reprocess-use-sell-order', false); +const useSellOrderForMarket = useStorage('reprocess-market-use-sell-order', false); +const useSellOrderForMaterials = useStorage('reprocess-materials-use-sell-order', false); -const { sortedArray, headerProps } = useSort(computed(() => props.result.map(r => ({ - ...r, - buy_ratio: r.buy === 0 ? 1 : (r.buy_reprocess / r.buy) - 1, - sell_ratio: r.sell === 0 ? 1 : (r.sell_reprocess / r.sell) - 1 -}))), { +const { sortedArray, headerProps } = useSort(computed(() => props.result.map(r => { + const market = useSellOrderForMarket.value ? r.sell : r.buy; + const materials = useSellOrderForMaterials.value ? r.sell_reprocess : r.buy_reprocess; + const ratio = market === 0 ? 1 : ((materials / market) - 1); + + return { ...r, market, materials, ratio }; +})), { defaultSortKey: 'name', defaultSortDirection: 'asc' }) -@/components/table \ No newline at end of file