mirror of
https://github.com/mealie-recipes/mealie.git
synced 2025-08-04 21:15:22 +02:00
feat: Seed support for plural units (#3933)
Co-authored-by: Hayden <64056131+hay-kot@users.noreply.github.com>
This commit is contained in:
parent
828afe6674
commit
2cd1e0ad37
3 changed files with 45 additions and 4 deletions
|
@ -1,101 +1,140 @@
|
||||||
{
|
{
|
||||||
"teaspoon": {
|
"teaspoon": {
|
||||||
"name": "teaspoon",
|
"name": "teaspoon",
|
||||||
|
"plural_name": "teaspoons",
|
||||||
"description": "",
|
"description": "",
|
||||||
"abbreviation": "tsp"
|
"abbreviation": "tsp"
|
||||||
},
|
},
|
||||||
"tablespoon": {
|
"tablespoon": {
|
||||||
"name": "tablespoon",
|
"name": "tablespoon",
|
||||||
|
"plural_name": "tablespoons",
|
||||||
"description": "",
|
"description": "",
|
||||||
"abbreviation": "tbsp"
|
"abbreviation": "tbsp"
|
||||||
},
|
},
|
||||||
"cup": {
|
"cup": {
|
||||||
"name": "cup",
|
"name": "cup",
|
||||||
|
"plural_name": "cups",
|
||||||
"description": "",
|
"description": "",
|
||||||
"abbreviation": "cup"
|
"abbreviation": "c"
|
||||||
},
|
},
|
||||||
"fluid-ounce": {
|
"fluid-ounce": {
|
||||||
"name": "fluid ounce",
|
"name": "fluid ounce",
|
||||||
|
"plural_name": "fluid ounces",
|
||||||
"description": "",
|
"description": "",
|
||||||
"abbreviation": "fl oz"
|
"abbreviation": "fl oz"
|
||||||
},
|
},
|
||||||
"pint": {
|
"pint": {
|
||||||
"name": "pint",
|
"name": "pint",
|
||||||
|
"plural_name": "pints",
|
||||||
"description": "",
|
"description": "",
|
||||||
"abbreviation": "pt"
|
"abbreviation": "pt"
|
||||||
},
|
},
|
||||||
"quart": {
|
"quart": {
|
||||||
"name": "quart",
|
"name": "quart",
|
||||||
|
"plural_name": "quarts",
|
||||||
"description": "",
|
"description": "",
|
||||||
"abbreviation": "qt"
|
"abbreviation": "qt"
|
||||||
},
|
},
|
||||||
"gallon": {
|
"gallon": {
|
||||||
"name": "gallon",
|
"name": "gallon",
|
||||||
|
"plural_name": "gallons",
|
||||||
"description": "",
|
"description": "",
|
||||||
"abbreviation": "gal"
|
"abbreviation": "gal"
|
||||||
},
|
},
|
||||||
"milliliter": {
|
"milliliter": {
|
||||||
"name": "milliliter",
|
"name": "milliliter",
|
||||||
|
"plural_name": "milliliters",
|
||||||
"description": "",
|
"description": "",
|
||||||
"abbreviation": "ml"
|
"abbreviation": "ml"
|
||||||
},
|
},
|
||||||
"liter": {
|
"liter": {
|
||||||
"name": "liter",
|
"name": "liter",
|
||||||
|
"plural_name": "liters",
|
||||||
"description": "",
|
"description": "",
|
||||||
"abbreviation": "l"
|
"abbreviation": "l"
|
||||||
},
|
},
|
||||||
"pound": {
|
"pound": {
|
||||||
"name": "pound",
|
"name": "pound",
|
||||||
|
"plural_name": "pounds",
|
||||||
"description": "",
|
"description": "",
|
||||||
"abbreviation": "lb"
|
"abbreviation": "lb",
|
||||||
|
"plural_abbreviation": "lbs"
|
||||||
},
|
},
|
||||||
"ounce": {
|
"ounce": {
|
||||||
"name": "ounce",
|
"name": "ounce",
|
||||||
|
"plural_name": "ounces",
|
||||||
"description": "",
|
"description": "",
|
||||||
"abbreviation": "oz"
|
"abbreviation": "oz"
|
||||||
},
|
},
|
||||||
"gram": {
|
"gram": {
|
||||||
"name": "gram",
|
"name": "gram",
|
||||||
|
"plural_name": "grams",
|
||||||
"description": "",
|
"description": "",
|
||||||
"abbreviation": "g"
|
"abbreviation": "g"
|
||||||
},
|
},
|
||||||
"kilogram": {
|
"kilogram": {
|
||||||
"name": "kilogram",
|
"name": "kilogram",
|
||||||
|
"plural_name": "kilograms",
|
||||||
"description": "",
|
"description": "",
|
||||||
"abbreviation": "kg"
|
"abbreviation": "kg"
|
||||||
},
|
},
|
||||||
"milligram": {
|
"milligram": {
|
||||||
"name": "milligram",
|
"name": "milligram",
|
||||||
|
"plural_name": "milligrams",
|
||||||
"description": "",
|
"description": "",
|
||||||
"abbreviation": "mg"
|
"abbreviation": "mg"
|
||||||
},
|
},
|
||||||
"splash": {
|
"splash": {
|
||||||
"name": "splash",
|
"name": "splash",
|
||||||
|
"plural_name": "splashes",
|
||||||
"description": "",
|
"description": "",
|
||||||
"abbreviation": ""
|
"abbreviation": ""
|
||||||
},
|
},
|
||||||
"dash": {
|
"dash": {
|
||||||
"name": "dash",
|
"name": "dash",
|
||||||
|
"plural_name": "dashes",
|
||||||
"description": "",
|
"description": "",
|
||||||
"abbreviation": ""
|
"abbreviation": ""
|
||||||
},
|
},
|
||||||
"serving": {
|
"serving": {
|
||||||
"name": "serving",
|
"name": "serving",
|
||||||
|
"plural_name": "servings",
|
||||||
"description": "",
|
"description": "",
|
||||||
"abbreviation": ""
|
"abbreviation": ""
|
||||||
},
|
},
|
||||||
"head": {
|
"head": {
|
||||||
"name": "head",
|
"name": "head",
|
||||||
|
"plural_name": "heads",
|
||||||
"description": "",
|
"description": "",
|
||||||
"abbreviation": ""
|
"abbreviation": ""
|
||||||
},
|
},
|
||||||
"clove": {
|
"clove": {
|
||||||
"name": "clove",
|
"name": "clove",
|
||||||
|
"plural_name": "cloves",
|
||||||
"description": "",
|
"description": "",
|
||||||
"abbreviation": ""
|
"abbreviation": ""
|
||||||
},
|
},
|
||||||
"can": {
|
"can": {
|
||||||
"name": "can",
|
"name": "can",
|
||||||
|
"plural_name": "cans",
|
||||||
|
"description": "",
|
||||||
|
"abbreviation": ""
|
||||||
|
},
|
||||||
|
"bunch": {
|
||||||
|
"name": "bunch",
|
||||||
|
"plural_name": "bunches",
|
||||||
|
"description": "",
|
||||||
|
"abbreviation": ""
|
||||||
|
},
|
||||||
|
"pack": {
|
||||||
|
"name": "pack",
|
||||||
|
"plural_name": "packs",
|
||||||
|
"description": "",
|
||||||
|
"abbreviation": ""
|
||||||
|
},
|
||||||
|
"pinch": {
|
||||||
|
"name": "pinch",
|
||||||
|
"plural_name": "pinches",
|
||||||
"description": "",
|
"description": "",
|
||||||
"abbreviation": ""
|
"abbreviation": ""
|
||||||
}
|
}
|
||||||
|
|
|
@ -60,8 +60,10 @@ class IngredientUnitsSeeder(AbstractSeeder):
|
||||||
yield SaveIngredientUnit(
|
yield SaveIngredientUnit(
|
||||||
group_id=self.group_id,
|
group_id=self.group_id,
|
||||||
name=unit["name"],
|
name=unit["name"],
|
||||||
|
plural_name=unit.get("plural_name"),
|
||||||
description=unit["description"],
|
description=unit["description"],
|
||||||
abbreviation=unit["abbreviation"],
|
abbreviation=unit["abbreviation"],
|
||||||
|
plural_abbreviation=unit.get("plural_abbreviation"),
|
||||||
)
|
)
|
||||||
|
|
||||||
def seed(self, locale: str | None = None) -> None:
|
def seed(self, locale: str | None = None) -> None:
|
||||||
|
|
|
@ -27,7 +27,7 @@ def test_seed_foods(api_client: TestClient, unique_user: TestUser, database: All
|
||||||
|
|
||||||
|
|
||||||
def test_seed_units(api_client: TestClient, unique_user: TestUser, database: AllRepositories):
|
def test_seed_units(api_client: TestClient, unique_user: TestUser, database: AllRepositories):
|
||||||
CREATED_UNITS = 20
|
CREATED_UNITS = 23
|
||||||
|
|
||||||
# Check that the foods was created
|
# Check that the foods was created
|
||||||
units = database.ingredient_units.by_group(unique_user.group_id).get_all()
|
units = database.ingredient_units.by_group(unique_user.group_id).get_all()
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue