cookbook icon indicating copy to clipboard operation
cookbook copied to clipboard

Automatically round ingredient amounts to useful precision

Open aaronsegura opened this issue 2 years ago • 3 comments

Description Recipe pulled from URL shows long floating point values for ingredients

Reproduction Steps to reproduce the behavior:

  1. add recipe from URL: https://www.allrecipes.com/recipe/246195/chef-johns-homemade-eggnog/

Expected behavior Should either display "0.3 Cups" or "1/3 Cup" for sugar

Actual behavior Ingredients list shows 0.33333334326744 cups of sugar

Screenshots image

Browser 1.46.144 Chromium: 108.0.5359.128 (Official Build) (64-bit)

Versions Nextcloud server version: 25.0.2 Cookbook version: 0.10.1 Database system: MySQL


Depends on #116

aaronsegura avatar Dec 24 '22 15:12 aaronsegura

Sorry - after further investigation (surely, right after hitting 'submit') I found the embedded schema on the page, which is the source for the float value. My bad.

"recipeIngredient": [
"0.33333334326744 cup white sugar",

aaronsegura avatar Dec 24 '22 15:12 aaronsegura

I reopen this issue as a rounding feature for all recipes or all ingredients of one recipe might be something useful. However, we need to split the ingredients into numbers, units, etc in order to do calculations with the values.

christianlupus avatar Dec 25 '22 11:12 christianlupus

This PR/issue depends on:

github-actions[bot] avatar Apr 09 '23 19:04 github-actions[bot]