mirror of
https://github.com/mealie-recipes/mealie.git
synced 2025-07-09 03:04:54 -04:00
fix: Bad Recipe Rating Calc Preventing App Startup (#3475)
This commit is contained in:
parent
6e1112c73e
commit
46f1ad7941
@ -260,13 +260,12 @@ def receive_description(target: RecipeModel, value: str, oldvalue, initiator):
|
|||||||
@event.listens_for(RecipeModel, "before_update")
|
@event.listens_for(RecipeModel, "before_update")
|
||||||
def calculate_rating(mapper, connection, target: RecipeModel):
|
def calculate_rating(mapper, connection, target: RecipeModel):
|
||||||
session = object_session(target)
|
session = object_session(target)
|
||||||
if not session:
|
if not (session and session.is_modified(target, "rating")):
|
||||||
return
|
return
|
||||||
|
|
||||||
if session.is_modified(target, "rating"):
|
history = get_history(target, "rating")
|
||||||
history = get_history(target, "rating")
|
old_value = history.deleted[0] if history.deleted else None
|
||||||
old_value = history.deleted[0] if history.deleted else None
|
new_value = history.added[0] if history.added else None
|
||||||
new_value = history.added[0] if history.added else None
|
|
||||||
if old_value == new_value:
|
if old_value == new_value:
|
||||||
return
|
return
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user