Measurement Specifiers

An ingredient combining curveball

In recipes, it’s really common for items to be sold in ways that are not purely just standard units. And to the person shopping, a list would be confusing for the plain units of the item to be listed.

Let’s just look at an example:

 

(0.4 oz) package buttermilk ranch dressing mix

 

This might seem simple - OH it’s just 0.4 oz of buttermilk ranch dressing mix. And I suppose it really COULD be that simple. But the recipe is saying that an entire package will be needed, so rather than buying a tub, which might make more sense, it also might NOT make that much sense.

So I’m adding another feature.

Measurement Specifiers

Because there are things like, “jar”, or “can” or “package” and they all have different weights and sizes, I’m going to make it so that the list that is generated at the end calls out each of these items in their stated forms from the recipe.

If there are 3 (0.4 oz package) items to buy, then that’s how the list will look

  • 3x 0.4 oz packages of buttermilk ranch dressing mix

At that point, if I want to buy 1.2 oz of buttermilk ranch dressing in some other form in the store, I can make that decision.

What does that look like?

 

½ :q: jar :m: (12 ounce) :ms: >> pepperoncini

 

This will allow me to specify that I need 0.5 12-ounce jars of pepperoncini. If I have multiple call-outs for 12-ounce jars of pepperoncini, the quantity will still sum.

It’s only a bit of extra work in the validator and a one-liner change in the ingredients combinator. And I think it’ll be a nicer read from the halls of the grocery store.

Well, I’ll be unit testing all the new functions, and then integration testing those functions in the combinator, so this is probably an additional 2-4 hours of work. So I’m really cramming stuff in prior to that 1.Apr deadline (today is 22.Mar).

Conclusion

It’s worth my time to add a new feature in the last 7 days I have allocated for this project to make it feel a bit nicer while I’m in the store looking at my list. I’d like to know what the original recipe calls out for in package sizes, and this will handle that. Grouping together multiple call-outs of the same package size.

Previous
Previous

First Grocery List Generated!

Next
Next

Ingredients Validation Complete