mirror of
https://github.com/mealie-recipes/mealie.git
synced 2025-07-09 03:04:54 -04:00
fix: use == operator instead of is_ for sql queries (#1453)
This commit is contained in:
parent
f96a584a5d
commit
157bad0e29
@ -15,14 +15,14 @@ class RepositoryMealPlanRules(RepositoryGeneric[PlanRulesOut, GroupMealPlanRules
|
||||
def get_rules(self, day: PlanRulesDay, entry_type: PlanRulesType) -> list[PlanRulesOut]:
|
||||
qry = self.session.query(GroupMealPlanRules).filter(
|
||||
or_(
|
||||
GroupMealPlanRules.day.is_(day),
|
||||
GroupMealPlanRules.day == day,
|
||||
GroupMealPlanRules.day.is_(None),
|
||||
GroupMealPlanRules.day.is_(PlanRulesDay.unset.value),
|
||||
GroupMealPlanRules.day == PlanRulesDay.unset.value,
|
||||
),
|
||||
or_(
|
||||
GroupMealPlanRules.entry_type.is_(entry_type),
|
||||
GroupMealPlanRules.entry_type == entry_type,
|
||||
GroupMealPlanRules.entry_type.is_(None),
|
||||
GroupMealPlanRules.entry_type.is_(PlanRulesType.unset.value),
|
||||
GroupMealPlanRules.entry_type == PlanRulesType.unset.value,
|
||||
),
|
||||
)
|
||||
|
||||
|
@ -228,7 +228,7 @@ class RepositoryRecipes(RepositoryGeneric[Recipe, RecipeModel]):
|
||||
if categories:
|
||||
cat_ids = [x.id for x in categories]
|
||||
if require_all_categories:
|
||||
fltr.extend(RecipeModel.recipe_category.any(Category.id.is_(cat_id)) for cat_id in cat_ids)
|
||||
fltr.extend(RecipeModel.recipe_category.any(Category.id == cat_id) for cat_id in cat_ids)
|
||||
else:
|
||||
fltr.append(RecipeModel.recipe_category.any(Category.id.in_(cat_ids)))
|
||||
|
||||
@ -243,7 +243,7 @@ class RepositoryRecipes(RepositoryGeneric[Recipe, RecipeModel]):
|
||||
tool_ids = [x.id for x in tools]
|
||||
|
||||
if require_all_tools:
|
||||
fltr.extend(RecipeModel.tools.any(Tool.id.is_(tool_id)) for tool_id in tool_ids)
|
||||
fltr.extend(RecipeModel.tags.any(Tag.id == tag_id) for tag_id in tag_ids)
|
||||
else:
|
||||
fltr.append(RecipeModel.tools.any(Tool.id.in_(tool_ids)))
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user