mirror of
https://github.com/mealie-recipes/mealie.git
synced 2025-07-25 08:09:41 +02:00
feat: plural foods and units, and aliases (#2674)
* added plural names and alias tables to foods/units
* updated models to include plural names and aliases
* updated parser to include plural and aliases
* fixed migrations
* fixed recursive models
* added plural abbreviation to migration
* updated parser and display prop
* update displays to use plurals
* fix display edgecase and remove print
* added/updated display tests
* fixed model bug and added parser tests
* added tests for aliases
* added new plural options to data management page
* removed unique constraint
* made base dialog more customizable
* added alias management to food and unit data pages
* removed unused awaits
* 🧹
This commit is contained in:
parent
4b55b838ed
commit
d440d51ffe
17 changed files with 1181 additions and 104 deletions
|
@ -9,7 +9,9 @@ from mealie.db.db_setup import session_context
|
|||
from mealie.repos.repository_factory import AllRepositories
|
||||
from mealie.schema.recipe.recipe_ingredient import (
|
||||
CreateIngredientFood,
|
||||
CreateIngredientFoodAlias,
|
||||
CreateIngredientUnit,
|
||||
CreateIngredientUnitAlias,
|
||||
IngredientFood,
|
||||
IngredientUnit,
|
||||
ParsedIngredient,
|
||||
|
@ -67,6 +69,12 @@ def parsed_ingredient_data(
|
|||
SaveIngredientFood(name="fresh ginger", group_id=unique_local_group_id),
|
||||
SaveIngredientFood(name="ground ginger", group_id=unique_local_group_id),
|
||||
SaveIngredientFood(name="ñör̃m̈ãl̈ĩz̈ẽm̈ẽ", group_id=unique_local_group_id),
|
||||
SaveIngredientFood(name="PluralFoodTest", plural_name="myfoodisplural", group_id=unique_local_group_id),
|
||||
SaveIngredientFood(
|
||||
name="IHaveAnAlias",
|
||||
group_id=unique_local_group_id,
|
||||
aliases=[CreateIngredientFoodAlias(name="thisismyalias")],
|
||||
),
|
||||
]
|
||||
)
|
||||
|
||||
|
@ -86,6 +94,18 @@ def parsed_ingredient_data(
|
|||
SaveIngredientUnit(name="Teaspoon", group_id=unique_local_group_id),
|
||||
SaveIngredientUnit(name="Stalk", group_id=unique_local_group_id),
|
||||
SaveIngredientUnit(name="My Very Long Unit Name", abbreviation="mvlun", group_id=unique_local_group_id),
|
||||
SaveIngredientUnit(
|
||||
name="PluralUnitName",
|
||||
plural_name="abc123",
|
||||
abbreviation="doremiabc",
|
||||
plural_abbreviation="doremi123",
|
||||
group_id=unique_local_group_id,
|
||||
),
|
||||
SaveIngredientUnit(
|
||||
name="IHaveAnAliasToo",
|
||||
group_id=unique_local_group_id,
|
||||
aliases=[CreateIngredientUnitAlias(name="thisismyalias")],
|
||||
),
|
||||
]
|
||||
)
|
||||
|
||||
|
@ -267,6 +287,46 @@ def test_brute_parser(unique_user: TestUser):
|
|||
True,
|
||||
id="normalization",
|
||||
),
|
||||
pytest.param(
|
||||
build_parsed_ing(unit=None, food="myfoodisplural"),
|
||||
None,
|
||||
"PluralFoodTest",
|
||||
False,
|
||||
True,
|
||||
id="plural food name",
|
||||
),
|
||||
pytest.param(
|
||||
build_parsed_ing(unit="abc123", food=None),
|
||||
"PluralUnitName",
|
||||
None,
|
||||
True,
|
||||
False,
|
||||
id="plural unit name",
|
||||
),
|
||||
pytest.param(
|
||||
build_parsed_ing(unit="doremi123", food=None),
|
||||
"PluralUnitName",
|
||||
None,
|
||||
True,
|
||||
False,
|
||||
id="plural unit abbreviation",
|
||||
),
|
||||
pytest.param(
|
||||
build_parsed_ing(unit=None, food="thisismyalias"),
|
||||
None,
|
||||
"IHaveAnAlias",
|
||||
False,
|
||||
True,
|
||||
id="food alias",
|
||||
),
|
||||
pytest.param(
|
||||
build_parsed_ing(unit="thisismyalias", food=None),
|
||||
"IHaveAnAliasToo",
|
||||
None,
|
||||
True,
|
||||
False,
|
||||
id="unit alias",
|
||||
),
|
||||
),
|
||||
)
|
||||
def test_parser_ingredient_match(
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue