This commit is contained in:
@@ -64,7 +64,9 @@ def parse_ingredient(
|
|||||||
|
|
||||||
return [text.strip() if text else None for text in m.groups()]
|
return [text.strip() if text else None for text in m.groups()]
|
||||||
|
|
||||||
def get_missing_ingredients(session):
|
# this code is unused
|
||||||
|
# TODO: add tests when this is used
|
||||||
|
def missing_ingredients_query(session):
|
||||||
cte = (
|
cte = (
|
||||||
except_(select(db.RecipeIngredient.id), select(db.RecipeIngredientParts.id))
|
except_(select(db.RecipeIngredient.id), select(db.RecipeIngredientParts.id))
|
||||||
).alias("missing")
|
).alias("missing")
|
||||||
@@ -73,8 +75,10 @@ def get_missing_ingredients(session):
|
|||||||
)
|
)
|
||||||
return missing
|
return missing
|
||||||
|
|
||||||
def reparse_ingredients(session):
|
# this code is unused
|
||||||
missing = get_missing_ingredients(session)
|
# TODO: add tests when this is used
|
||||||
|
def parse_missing_ingredients(session):
|
||||||
|
missing = missing_ingredients_query(session)
|
||||||
for ingredient in missing:
|
for ingredient in missing:
|
||||||
parts = ingredient_to_parts(ingredient)
|
parts = ingredient_to_parts(ingredient)
|
||||||
session.add(parts)
|
session.add(parts)
|
||||||
|
|||||||
Reference in New Issue
Block a user