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

[Suggestion] Allow decimal values when adding quantities in recipes #95

Open
l0f4r0 opened this issue Apr 6, 2022 · 0 comments
Open
Labels
enhancement New feature or request

Comments

@l0f4r0
Copy link

l0f4r0 commented Apr 6, 2022

It would be nice to allow the user to enter in decimal values when adding some items in recipe edition.

Expected Behavior

Recognize inputs like "0,80 cl vodka" or "0.30 cl gin".

Current Behavior

Parsing doesn't not recognize decimal values directly (the user needs to enter the value in fractional form like "1/2 cl vodka", not "0,50 cl vodka" nor "0.50 cl vodka").
NB: Edition afterwards works by modifying the "amount" field.

DEBUG info

Fractional form works:

DEBUG:   /tmp/.mount_GourmaWJJP1c/opt/python3.8/lib/python3.8/site-packages/gourmand/backends/db.py: 1889 ingredient_parser handed: 1/2 cl gin
DEBUG:   /tmp/.mount_GourmaWJJP1c/opt/python3.8/lib/python3.8/site-packages/gourmand/backends/db.py: 1934 ingredient_parser returning: {'amount': 0.5, 'unit': 'cl', 'item': 'gin', 'ingkey': 'gin'}

Decimal forms don't work:

DEBUG:   /tmp/.mount_GourmaWJJP1c/opt/python3.8/lib/python3.8/site-packages/gourmand/backends/db.py: 1889 ingredient_parser handed: 0,50 cl vermouth
DEBUG:   /tmp/.mount_GourmaWJJP1c/opt/python3.8/lib/python3.8/site-packages/gourmand/backends/db.py: 1937 Unable to parse 0,50 cl vermouth

DEBUG:   /tmp/.mount_GourmaWJJP1c/opt/python3.8/lib/python3.8/site-packages/gourmand/backends/db.py: 1889 ingredient_parser handed: 0.50 cl rhum
DEBUG:   /tmp/.mount_GourmaWJJP1c/opt/python3.8/lib/python3.8/site-packages/gourmand/backends/db.py: 1934 ingredient_parser returning: {'amount': 0.0, 'item': '.50 cl rhum', 'ingkey': '.50 cl rhum'}

Environment

Operating System: Linux Debian 10 64bits
Version or commit id: Gourmand-1.1.0rc2-x86_64.AppImage

@FriedrichFroebel FriedrichFroebel added the enhancement New feature or request label Dec 28, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants