Skip to content

fix: ingredients showing NaN in some cases #2003

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jan 7, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
- Prevent yield calculation for ## as ingredient headline [#1998](https://github.com./nextcloud/cookbook/pull/1998) @j0hannesr0th
- Improved styling of times in recipe view [#2014](https://github.com./nextcloud/cookbook/pull/2014) @seyfeb
- Add missing translatable string for recipe-creation button in empty list view [#2015](https://github.com./nextcloud/cookbook/pull/2015) @seyfeb
- Prevent recalculation algorithm if no yield is given [#2003](https://github.com./nextcloud/cookbook/pull/2003) @j0hannesr0th

### Documentation
- Improve structure of `README.md` [#1989](https://github.com./nextcloud/cookbook/pull/1989) @seyfeb
Expand Down
4 changes: 2 additions & 2 deletions src/components/RecipeView/RecipeView.vue
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@
</span>
<span class="print-hidden">
<button
:disabled="recipeYield === 1"
:disabled="recipeYield <= 1"
@click="changeRecipeYield(false)"
>
<span class="icon-view-previous" />
Expand Down Expand Up @@ -640,7 +640,7 @@ const setup = async () => {
};

const changeRecipeYield = (increase = true) => {
recipeYield.value += increase ? 1 : -1;
recipeYield.value = +recipeYield.value + (increase ? 1 : -1);
};

function showCopySuccess(item) {
Expand Down
2 changes: 1 addition & 1 deletion src/js/yieldCalculator.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ function isValidIngredientSyntax(ingredient) {

/*
The ingredientMultipleSeperatorsRegExp is used to check whether the string contains
more than one separators (.,) after a number. This is used to exclude strings that
more than one separator (.,) after a number. This is used to exclude strings that
contain more than one separator from being valid.
*/
const ingredientMultipleSeparatorsRegExp = /^-?\d+(?:[.,]\d+){2,}.*/;
Expand Down