julianpoy / RecipeSage

A Collaborative Recipe Keeper, Meal Planner, and Shopping List Organizer in PWA form.
https://recipesage.com
639 stars 64 forks source link

Add yield and fraction button to scale modal #1452

Open DanTup opened 2 months ago

DanTup commented 2 months ago

I added the Pizza Dough recipes from Ooni which makes 4x 12" pizza doughs. I entered '4 12" Pizzas' in the Yield field and copied the ingredients amounts as-is, and I see there's a Scaling option when I view the recipe, but because the original recipe is for 4 doughs, the scaling options are slightly awkward (eg. I'd have to enter 1/4 if I wanted to make one, or 5/4 if I wanted to make 5).

While I could scale the default recipe down to 1/4 of the amounts and then the scaling amounts would be "per dough", it might be nice if the yield info could be used in the UI for scale. Eg. if I enter "4 Doughs" (or "4 People") in the yield box, have the scaling UI show "1 Dough", "2 Doughs" etc.. That would make it easier to make "5 doughs" from a "4 dough" recipe, for example.

(Thanks for the app! I'm trying to find a decent recipe app that I can access across devices - all the others I've tried so far have had annoyances that made me discount them very quickly, but so far I quite like this one :-))

julianpoy commented 3 weeks ago

While I'd love to do this, I do believe this has a high chance of being inconsistent unfortunately. It would also involve a lot of language-specific parsing.

I do believe there are two approaches we could take here to improve the experience:

  1. Display the yield within the scale modal
  2. Add a 1/2 button to the scale modal
DanTup commented 3 weeks ago

There's already a 1/2 button for scaling, but you still have to do the maths in your head (like if it makes 5 portions, 1/2 doesn't help). Showing the yield field on the popup would definitely help.

What about recognising something very specific, like "(\d+) portions" in the yield field, and if it matches then on the scale popup, show an additional label with the new portion number? You could show a tip: "Enter yield as x portions for easier scaling" to encourage people to do this, but if they enter free text it'd still work as-is today.

Eg.:

This would allow the maths to be done automatically if we stick to the format, but doesn't risk showing anything incorrectly for those that don't. (you could probably even support some additional strings like "portions|person|people" where it's clear they'd work correctly, even if the tip only suggests one of them).