Skip to content

Commit

Permalink
rounding
Browse files Browse the repository at this point in the history
  • Loading branch information
Kuchenpirat committed Oct 1, 2024
1 parent d85e486 commit 722a124
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions frontend/components/Domain/Recipe/RecipeScaleEditButton.vue
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
<span v-if="!recipeYield"> x {{ scale }} </span>
<div v-else-if="!numberParsed && recipeYield">
<span v-if="numerator === 1"> {{ recipeYield }} </span>
<span v-else> {{ numerator }}x {{ recipeYield }} </span>
<span v-else> {{ numerator }}x {{ scaledYield }} </span>
</div>
<span v-else> {{ scaledYield }} </span>

Expand Down Expand Up @@ -97,13 +97,12 @@ export default defineComponent({
},
});
const numerator = ref<number>(props.basicYieldNum ?? 1);
const denominator = props.basicYieldNum ?? 1;
const numerator = ref<number>(parseFloat(props.basicYieldNum.toFixed(3)) ?? 1);
const denominator = parseFloat(props.basicYieldNum.toFixed(32)) ?? 1;
const numberParsed = !!props.basicYieldNum;
watch(() => numerator.value, (newValue) => {
console.log("newValue", newValue);
scale.value = numerator.value / denominator;
watch(() => numerator.value, () => {
scale.value = parseFloat((numerator.value / denominator).toFixed(3));
});
const disableDecrement = computed(() => {
return numerator.value <= 1;
Expand Down

0 comments on commit 722a124

Please sign in to comment.