1
0
Fork 0
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:
Brian Choromanski 2024-08-20 10:33:20 -04:00 committed by GitHub
parent 828afe6674
commit 2cd1e0ad37
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 45 additions and 4 deletions

View file

@ -1,101 +1,140 @@
{
"teaspoon": {
"name": "teaspoon",
"plural_name": "teaspoons",
"description": "",
"abbreviation": "tsp"
},
"tablespoon": {
"name": "tablespoon",
"plural_name": "tablespoons",
"description": "",
"abbreviation": "tbsp"
},
"cup": {
"name": "cup",
"plural_name": "cups",
"description": "",
"abbreviation": "cup"
"abbreviation": "c"
},
"fluid-ounce": {
"name": "fluid ounce",
"plural_name": "fluid ounces",
"description": "",
"abbreviation": "fl oz"
},
"pint": {
"name": "pint",
"plural_name": "pints",
"description": "",
"abbreviation": "pt"
},
"quart": {
"name": "quart",
"plural_name": "quarts",
"description": "",
"abbreviation": "qt"
},
"gallon": {
"name": "gallon",
"plural_name": "gallons",
"description": "",
"abbreviation": "gal"
},
"milliliter": {
"name": "milliliter",
"plural_name": "milliliters",
"description": "",
"abbreviation": "ml"
},
"liter": {
"name": "liter",
"plural_name": "liters",
"description": "",
"abbreviation": "l"
},
"pound": {
"name": "pound",
"plural_name": "pounds",
"description": "",
"abbreviation": "lb"
"abbreviation": "lb",
"plural_abbreviation": "lbs"
},
"ounce": {
"name": "ounce",
"plural_name": "ounces",
"description": "",
"abbreviation": "oz"
},
"gram": {
"name": "gram",
"plural_name": "grams",
"description": "",
"abbreviation": "g"
},
"kilogram": {
"name": "kilogram",
"plural_name": "kilograms",
"description": "",
"abbreviation": "kg"
},
"milligram": {
"name": "milligram",
"plural_name": "milligrams",
"description": "",
"abbreviation": "mg"
},
"splash": {
"name": "splash",
"plural_name": "splashes",
"description": "",
"abbreviation": ""
},
"dash": {
"name": "dash",
"plural_name": "dashes",
"description": "",
"abbreviation": ""
},
"serving": {
"name": "serving",
"plural_name": "servings",
"description": "",
"abbreviation": ""
},
"head": {
"name": "head",
"plural_name": "heads",
"description": "",
"abbreviation": ""
},
"clove": {
"name": "clove",
"plural_name": "cloves",
"description": "",
"abbreviation": ""
},
"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": "",
"abbreviation": ""
}

View file

@ -60,8 +60,10 @@ class IngredientUnitsSeeder(AbstractSeeder):
yield SaveIngredientUnit(
group_id=self.group_id,
name=unit["name"],
plural_name=unit.get("plural_name"),
description=unit["description"],
abbreviation=unit["abbreviation"],
plural_abbreviation=unit.get("plural_abbreviation"),
)
def seed(self, locale: str | None = None) -> None:

View file

@ -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):
CREATED_UNITS = 20
CREATED_UNITS = 23
# Check that the foods was created
units = database.ingredient_units.by_group(unique_user.group_id).get_all()