mirror of
https://github.com/mealie-recipes/mealie.git
synced 2025-08-05 13:35:23 +02:00
fix: Bad Recipe Rating Calc Preventing App Startup (#3475)
Some checks are pending
CodeQL / Analyze (javascript-typescript) (push) Waiting to run
CodeQL / Analyze (python) (push) Waiting to run
Docker Nightly Production / Backend Server Tests (push) Waiting to run
Docker Nightly Production / Frontend and End-to-End Tests (push) Waiting to run
Docker Nightly Production / Build Tagged Release (push) Blocked by required conditions
Docker Nightly Production / Notify Discord (push) Blocked by required conditions
Some checks are pending
CodeQL / Analyze (javascript-typescript) (push) Waiting to run
CodeQL / Analyze (python) (push) Waiting to run
Docker Nightly Production / Backend Server Tests (push) Waiting to run
Docker Nightly Production / Frontend and End-to-End Tests (push) Waiting to run
Docker Nightly Production / Build Tagged Release (push) Blocked by required conditions
Docker Nightly Production / Notify Discord (push) Blocked by required conditions
This commit is contained in:
parent
6e1112c73e
commit
46f1ad7941
1 changed files with 4 additions and 5 deletions
|
@ -260,13 +260,12 @@ def receive_description(target: RecipeModel, value: str, oldvalue, initiator):
|
|||
@event.listens_for(RecipeModel, "before_update")
|
||||
def calculate_rating(mapper, connection, target: RecipeModel):
|
||||
session = object_session(target)
|
||||
if not session:
|
||||
if not (session and session.is_modified(target, "rating")):
|
||||
return
|
||||
|
||||
if session.is_modified(target, "rating"):
|
||||
history = get_history(target, "rating")
|
||||
old_value = history.deleted[0] if history.deleted else None
|
||||
new_value = history.added[0] if history.added else None
|
||||
history = get_history(target, "rating")
|
||||
old_value = history.deleted[0] if history.deleted else None
|
||||
new_value = history.added[0] if history.added else None
|
||||
if old_value == new_value:
|
||||
return
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue