Skip to content
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

Prevent recalculation algorithm if no yeild is given #1986

Closed
christianlupus opened this issue Dec 14, 2023 · 16 comments · Fixed by #2099
Closed

Prevent recalculation algorithm if no yeild is given #1986

christianlupus opened this issue Dec 14, 2023 · 16 comments · Fixed by #2099
Assignees
Labels
bug Something isn't working Frontend Issue or PR related to the frontend code good first issue Good for newcomers

Comments

@christianlupus
Copy link
Collaborator

The recalucaltion algorithm of the ingredients fails if the recipe yield is non-numeric or null. This will result in NaN entries while recipe viewing. This should be fixed.

@christianlupus christianlupus added bug Something isn't working good first issue Good for newcomers Frontend Issue or PR related to the frontend code labels Dec 14, 2023
@mohmaaya
Copy link

I'd like to fix this

@christianlupus
Copy link
Collaborator Author

I will assign you happily!

@christianlupus
Copy link
Collaborator Author

If you need help, feel free to contact us here, in the discussions or the matrix chat.

@mohmaaya
Copy link

Thanks, I ll work on it in sometime. :)

@mohmaaya
Copy link

mohmaaya commented Dec 15, 2023

Hi Christian,
I need a little help to understand how does the app work to run it locally.
Does the nextcloud/server acts as the backend? Or the cookbook is self contained because I am getting "Cannot GET /" at the moment when running locally.
Thanks

@christianlupus
Copy link
Collaborator Author

Hello @mohmaaya. There is the documentation page at https://nextcloud.github.io/cookbook/dev/contributing/setup that suggests mainly Julius' development setup. Did you find that and follow its process?

@stefan123t
Copy link

I do not know what caused the NaN in your case and therefor whether the fix from @j0hannesr0th will fix my newbie issue too ?

I have found that I got NaN for all ingredients until I entered the number of portions into the servings entry field.
Because it did not assume 1 as the default serving it was probably calculating / multiplying by 0 and that was reported as NaN.

Cheers for this fine piece of software!

I only had some minor difficulties as it is not yet readily available from the nextcloud app store and the documentation for administrators is still missing:

  • Download the correct version (Stable channel) from https://apps.nextcloud.com/apps/cookbook
    In my case I had to download 0.10.5 for Nextcloud 27.

  • Install it into your /nextcloud/apps folder

    cd /nextcloud/apps
    wget https://github.com/christianlupus-nextcloud/cookbook-releases/releases/download/v0.10.5/cookbook-0.10.5.tar.gz
    tar -xvzf cookbook-0.10.5.tar.gz
    
  • Enable Cookbook App under Profile > + Apps > Disabled Apps
    Cookbook (Enable)

@christianlupus
Copy link
Collaborator Author

@mohmaaya may I ask you if you had any success so far? It it progressing?

@mohmaaya
Copy link

@christianlupus I am so sorry but I got very busy that I completely forgot about this task. I can work on this in the next couple of days since I have time. Can you please let me know if the bug is fixed with johannes PR as I see above merge. If so, then I can take another task.

@christianlupus
Copy link
Collaborator Author

No problem. I just wanted to make sure we are not waiting on each other for some reason.

The issue is not solved yet. The provided PR was addressing some other issue. The actual problem in this issue is the division by zero in case the recipe yield cannot be parsed successfully. This is still the case.

@MikeSpaceG
Copy link

Is there a way to disable this "recalculation"? Most of my recipes now display recalc errors or NaN. I cannot find any other reference to this "feature."

@j0hannesr0th
Copy link
Contributor

j0hannesr0th commented Jan 14, 2024

Is there a way to disable this "recalculation"? Most of my recipes now display recalc errors or NaN. I cannot find any other reference to this "feature."

I have about 200 recipes and not a single one has any issue.

Can you share a recipe link that we can check if there is a bug? @MikeSpaceG

@christianlupus
Copy link
Collaborator Author

I think you can create a recipe simply. Just create a new recipe, give it a random name and put some ingredients with a number (so that the calculation is triggered). Make sure to not set the yield field (or set it to null). You will most probably see the NaNs due to x/0 calculation.

I have not tested right now the steps as I am on mobile but I tried it multiple times.

@christianlupus
Copy link
Collaborator Author

Here is a short video on the issue:

test.mp4

@j0hannesr0th
Copy link
Contributor

Here is a short video on the issue:

test.mp4

Will fix it today evening. I don't have a recipe without servings, so never noticed it.

@christianlupus
Copy link
Collaborator Author

@mohmaaya wanted to work on this issue, @j0hannesr0th. Please sync to avoid unnecessary doubled work and frustration on either side. Thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working Frontend Issue or PR related to the frontend code good first issue Good for newcomers
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants