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

@@ -42,14 +42,14 @@ def create_from_url(url: str) -> Recipe:
try:
recipe_data_service.scrape_image(new_recipe.image)
new_recipe.name = slugify(new_recipe.name)
new_recipe.slug = slugify(new_recipe.name)
new_recipe.image = cache.new_key(4)
except Exception as e:
recipe_data_service.logger.exception(f"Error Scraping Image: {e}")
new_recipe.image = "no image"
if new_recipe.name is None or new_recipe.name == "":
new_recipe.name = "No Recipe Name Found - " + str(uuid4())
new_recipe.name = f"No Recipe Name Found - {str(uuid4())}"
new_recipe.slug = slugify(new_recipe.name)
return new_recipe