fix threshold
This commit is contained in:
@@ -12,20 +12,22 @@ const props = withDefaults(defineProps<Props>(), {
|
|||||||
result: () => []
|
result: () => []
|
||||||
});
|
});
|
||||||
|
|
||||||
const computedResult = computed(() => props.result.map(r =>({
|
const threshold = useStorage('reprocess-threshold', 0);
|
||||||
...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', 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))
|
||||||
|
})
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<div class="grid mb-2 mt-4">
|
<div class="grid mb-2 mt-4">
|
||||||
<div class="justify-self-end">
|
<div class="justify-self-end">
|
||||||
<span>Threshold: </span>
|
<span class="ms-2">Threshold: </span>
|
||||||
<input type="number" min="-100" max="1000" step="1" v-model="threshold" />
|
<input type="number" min="-100" max="100" step="1" v-model="threshold" />
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<table>
|
<table>
|
||||||
@@ -39,7 +41,7 @@ const threshold = useStorage('reprocess-threshold', 100);
|
|||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
<tbody>
|
<tbody>
|
||||||
<tr v-for="r in computedResult" :key="r.typeID" :class="{'bg-emerald-500': r.buy_ratio * threshold >= 100 }">
|
<tr v-for="r in computedResult" :key="r.typeID" :class="{'bg-emerald-500': r.buy_ratio >= threshold / 100 }">
|
||||||
<td>{{ r.name }}</td>
|
<td>{{ r.name }}</td>
|
||||||
<td class="text-right">{{ iskFormater.format(r.buy) }}</td>
|
<td class="text-right">{{ iskFormater.format(r.buy) }}</td>
|
||||||
<td class="text-right">{{ iskFormater.format(r.buy_reprocess) }} ({{percentFormater.format(r.buy_ratio)}})</td>
|
<td class="text-right">{{ iskFormater.format(r.buy_reprocess) }} ({{percentFormater.format(r.buy_ratio)}})</td>
|
||||||
@@ -48,4 +50,4 @@ const threshold = useStorage('reprocess-threshold', 100);
|
|||||||
</tr>
|
</tr>
|
||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
</template>@/formaters
|
</template>
|
||||||
Reference in New Issue
Block a user