From dcb3c445bd26befb6e500e15762d2e1e9d2e25e5 Mon Sep 17 00:00:00 2001 From: Sirttas Date: Wed, 26 Jul 2023 15:32:23 +0200 Subject: [PATCH] fix threshold --- src/reprocess/ReprocessResultTable.vue | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/src/reprocess/ReprocessResultTable.vue b/src/reprocess/ReprocessResultTable.vue index e62855e..219157d 100644 --- a/src/reprocess/ReprocessResultTable.vue +++ b/src/reprocess/ReprocessResultTable.vue @@ -12,20 +12,22 @@ const props = withDefaults(defineProps(), { result: () => [] }); -const computedResult = computed(() => props.result.map(r =>({ - ...r, - buy_ratio: (r.buy_reprocess / r.buy) - 1, - sell_ratio: (r.sell_reprocess / r.sell) - 1 -})).sort((a, b) => a.name.localeCompare(b.name))) +const threshold = useStorage('reprocess-threshold', 0); -const threshold = useStorage('reprocess-threshold', 100); +const computedResult = computed(() => { + return 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 + })).sort((a, b) => a.name.localeCompare(b.name)) +}) @/formaters \ No newline at end of file + \ No newline at end of file