Fix/fix slug names (#1026)

* fix food seeder to use value instead of keys

* fix all recipe names being slugified

* add helper path utilities

* add fix script for database to rename foods

* add safe calling for fixes
This commit is contained in:
Hayden
2022-03-09 09:18:33 -09:00
committed by GitHub
parent de6fd9472d
commit 2d1ef7173d
8 changed files with 57 additions and 3 deletions

View File

View File

@@ -0,0 +1,5 @@
from pathlib import Path
CWD = Path(__file__).parent
en_us = CWD / "en-us.json"

View File

@@ -0,0 +1,5 @@
from pathlib import Path
CWD = Path(__file__).parent
en_us = CWD / "en-us.json"

View File

@@ -0,0 +1,5 @@
from pathlib import Path
CWD = Path(__file__).parent
en_us = CWD / "en-us.json"

View File

@@ -49,7 +49,8 @@ class IngredientUnitsSeeder(AbstractSeeder):
class IngredientFoodsSeeder(AbstractSeeder):
def load_data(self) -> Generator[SaveIngredientFood, None, None]:
file = self.resources / "foods" / "en-us.json"
for food in json.loads(file.read_text()):
foods: dict[str, str] = json.loads(file.read_text())
for food in foods.values():
yield SaveIngredientFood(
group_id=self.group_id,
name=food,