Closed (fixed)
Project:
Recipe
Version:
master
Component:
Miscellaneous
Priority:
Normal
Category:
Bug report
Assigned:
Reporter:
Created:
4 Sep 2006 at 09:11 UTC
Updated:
12 Dec 2006 at 18:00 UTC
Jump to comment: Most recent file
The quantity field does not allow fration numbers like 1/2, 1/4 Would be nice to have that. Otherwise the new Modul is great!
| Comment | File | Size | Author |
|---|---|---|---|
| #13 | fractions2.patch | 1.51 KB | moonray |
| #12 | fractions.patch | 1.38 KB | moonray |
| #7 | recipe.module.inputfractions1.patch | 1.87 KB | drawk |
| #5 | recipe.module.patch | 1.58 KB | drawk |
Comments
Comment #1
spazio commentedJust adding Version..
Comment #2
marble commentedYou can use decimal fractions (0.5, 0.25 etc), which are easier to parse and do the multiplication on when using a modified yield.
Comment #3
spazio commentedOk, thank you for the hint. I do it this way then. It is a bit strange to write e.g. 0.25 unit lemon, but I guess people will understand.
Thanks
Mario
Comment #4
drawk commentedI will be working on allowing fractions (1/4, 1/2, 1/8, etc..) to be used in the input and on a setting to choose how they are displayed in the recipe admin area.
Patch forthcoming.
Comment #5
drawk commentedPatch attached.
This allows users to use fractions like "1/2" or "1/8" when entering ingredients. They are converted to decimal when being stored in the database.
I'll open a new issue for allowing an admin setting to determine how fractions are displayed when viewing a recipe.
Comment #6
marble commentedLooks good, but waiting until it can handle stuff like "1 1/2" before applying.
Comment #7
drawk commentedShould be fixed now.
Comment #8
marble commentedApplied, thanks.
Comment #9
marble commentedComment #10
moonray commentedNice patch. One little problem when trying to display 1/3 (and I guess any 3, 6, 9, etc. fraction), though.
I get the following fraction: 1026405035⁄1215752192T
Comment #11
moonray commentedComment #12
moonray commentedAttached a patch against CVS that will fix the conversion issues with thirds, sixths, ninths, and twelfths.
It's not as elegant as a mathematical formula, but effective for the most likely to be encountered fractions.
Comment #13
moonray commentedSmall change to make sure you don't get numbers like 23 1/1 instead of 24.
New patch uploaded.
Comment #14
marble commentedThanks moonray. My dev drupal database is currently a bit messed up from some other stuff I was doing, but I shall get that cleared up and test/apply your patch within the next few days. From looking at it though, doesn't the substr rely on there being less than 10 whole units?
Comment #15
moonray commentedI'm not quite sure what you mean with your comment about substr? If you explain, and it's an issue, I'll try and fix it. :-)
Comment #16
marble commentedWell, I didn't test it out yet, but doing a substr($whatever, 2, 4) doesn't seem like it would get the right part of the string, if $whatever was "10.3333". (Admittedly fairly unlikely for a recipe, but possible if someone changes the yield to something large.)
Comment #17
moonray commentedAh! Now I understand.
$conversionstr = substr((string) ($conversion - floor($conversion)), 2, 4);The
$conversion - floor($conversion)part removes all digits before the decimal point, so you know that you always have 0.xxxxxxxx, which is why I can safely do a substr. No issue here. :-)Comment #18
marble commentedAh great. Sorry it took me so long, but I have now finally tried it, and checked it in.
Comment #19
(not verified) commented