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
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