kitchenowl icon indicating copy to clipboard operation
kitchenowl copied to clipboard

Bug: scraping the same ingredient several times in the same recipe is only partially transferred

Open crosspolar opened this issue 8 months ago • 4 comments

Is this urgent?

No

What parts are affected

Frontend

What is the server version

v109

What is the client version

v0.6.11

What platform are you using

Linux

What's the problem 🤔

When scraping the Chinese Pork Bun, "water" appears multiple times in the scraping menu

Image

In total, the recipe should have 190 ml + 1/2 cup of water. However, when finishing the scraping only 125ml are taken over:

Image

Share your logs


Share your configuration


crosspolar avatar May 01 '25 13:05 crosspolar

@TomBursch The reason for this is that currently the primary keys of RecipeItems are recipe_id and item_id, right?

I see two possible solutions, maybe you see more:

A Totally loosing the primary-key-constraint for item-id. B ingredient-groups as third primary-key, e.g. “dough” or “filling”.

I favor for nothing really, however would appreciate having ingredient-groups and started working on it recently, but it's more work than expected 😄 . Both solutions would mean that the markdown-logic would have to be reworked, I think. Also, if not all ingredients will be included in the recipe after parsing, a warning should appear but this is a new issue.

crosspolar avatar May 22 '25 07:05 crosspolar

ingredient-groups as third primary-key

I'm not sure if I like user entered strings as part of the primary key. This makes dealing with renaming the group and such a bit annoying.

Totally loosing the primary-key-constraint for item-id.

We could introduce an auto-incrementing integer primary key and only index the (item-id, recipe-id). This would allow adding the same ingredient multiple times to a recipe. Is that good or bad? But it would also fix #286 #615

(Also sorry I didn't respond to your mock-up, feel free to ping me or send a message on matrix if you want me to look at it)

TomBursch avatar May 22 '25 17:05 TomBursch

Don't apologize. This is an open source project, we're here for fun...

And I think you're right. I will try to setup a draft the next days so we can test it. If you don't hear anything about it from me, feel free to take over 😉

crosspolar avatar May 22 '25 18:05 crosspolar

Scraping wouldn't be the problem, but the current add-Items-to-Recipe-UI is not that trivial to change. However, with a few changes to SliverItemGridList it seems possible. The most straightforward UI would be adding a selectable copy of each selected Item, like follows:

The user selected Banana, so a second selectable Banana showed up.

Image

crosspolar avatar May 23 '25 16:05 crosspolar