1
0
Fork 0
mirror of https://github.com/mealie-recipes/mealie.git synced 2025-08-05 21:45:25 +02:00

fix: increased float rounding precision for CRF parser (#1369)

* increased float rounding precision for crf parser

* limited fractions to a max denominator of 32 to prevent weirdly specific values

* add test cases for 1/8 and 1/32

* add rounding to avoid more digits than necessary

Co-authored-by: Hayden <64056131+hay-kot@users.noreply.github.com>
This commit is contained in:
Michael Genson 2022-06-10 21:18:31 -05:00 committed by GitHub
parent 504bf41b9c
commit b904b161eb
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 9 additions and 5 deletions

View file

@ -74,7 +74,7 @@ class RecipeIngredient(MealieModel):
empty string.
"""
if isinstance(value, float):
return value
return round(value, 3)
if value is None or value == "":
return None
return value