Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
What type of PR is this?
(REQUIRED)
What this PR does / why we need it:
(REQUIRED)
Adds support for Tandoor migrations (see #2427). Also refactors the display property implemented in #2021 to apply to the
RecipeIngredient
class.Which issue(s) this PR fixes:
(REQUIRED)
N/A - discussed in #2427. The actual issue in that discussion is fixed by #2434
Special notes for your reviewer:
(fill-in or delete this section)
Since Tandoor provides structured data similar to Mealie (food, unit, qty) I needed to reuse the display property implemented in #2021. To make it easier to reuse I refactored all ingredient-like objects to use a new
RecipeIngredientBase
class which contains the display parsing logic.To do this, I had to add the
disable_amount
andis_food
to the base, which are effectively the same thing (but ingredients usedisable_amount
and shopping lists useis_food
). There's probably room to simplify this, but it would involve removing one of the fields which would require refactoring either recipes or shopping lists, which is outside the scope of this PR (honestly this refactor is too, but that would be even more out of scope...). I also noticed that the recipe'sdisable_amount
setting doesn't propagate down to its ingredients, so I overrode the Recipe__init__
andfrom_orm
to populate it correctly based on the recipe's settings (and shopping list items useis_food
so no changes were needed there):Testing
(fill-in or delete this section)
Imported the sample 500 or so recipes from #2427 and they look pretty good (see some example screenshots there). Manually checked a dozen or so, including some edge cases (e.g. missing data). 100% of those recipes imported with no errors. I also added sample data to the migration tests.
Release Notes
(REQUIRED)