-
Notifications
You must be signed in to change notification settings - Fork 95
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
Handle fractional ingredients (Fixes #2004) #2421
Conversation
Thank you for your contribution! Smaller than 1/16 probably does not make any sense indeed. 1/3 and 1/5 are debatable, though. However, as a starting point, having any conversion is better than none. In future iterations there could even be a toggle in the recipe view or some options in the configuration but that is not required immediately. I did not check the details yet, but one thing that comes to my mind is, there are ASCII/Unicode symbols for fractions like ¾. I think they should be handled, too. Maybe not all of them, but the most common ones? A quick Google search turned up this reference: https://www.compart.com/de/unicode/decomposition/%3Cfraction%3E |
Done. Should now parse unicode fractions, but will always display the output as 'normal' text (ie. using digits and a slash). I guess it would be possible to display the output with unicode fractions too, but at least for me they don't always display too nice in the browser. |
33af16a
to
0129c67
Compare
Handle 16ths during recalculation of ingredients, else use decimal Signed-off-by: Christian Wolf <github@christianwolf.email>
Signed-off-by: Christian Wolf <github@christianwolf.email>
0129c67
to
091c912
Compare
Test Results 12 files 584 suites 1m 37s ⏱️ Results for commit 8a39540. ♻️ This comment has been updated with latest results. |
Signed-off-by: Christian Wolf <github@christianwolf.email>
Signed-off-by: Christian Wolf <github@christianwolf.email>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Although there is a small bug there, this is better than before.
Topic and Scope
My solution to #2004. This handles 16ths, else falls back to decimal. I think this is a nice balance between using some fractions, without ending up with stupid denominators.
Concerns/issues
Will only work if the initial ingredient is given as a fraction. If it's a decimal, or just a whole number, will still remain decimal. Maybe it would make sense to convert everything to fractions where possible, but then maybe not. Perhaps being able to change the behavior in settings would be useful, idk. Also, by design does not do 1/3, 1/5, etc. I don't mind this, in fact I would prefer this way, but I guess in the end it's not up to me.
Formal requirements
There are some formal requirements that should be satisfied. Please mark those by checking the corresponding box.