Skip to content

Commit

Permalink
fix(signal): only record change event if changes detected
Browse files Browse the repository at this point in the history
  • Loading branch information
whitdog47 committed Feb 6, 2025
1 parent dc0898e commit c5aed04
Showing 1 changed file with 20 additions and 16 deletions.
36 changes: 20 additions & 16 deletions src/dispatch/signal/service.py
Original file line number Diff line number Diff line change
Expand Up @@ -602,24 +602,28 @@ def update(

db_session.commit()

if user:
individual = individual_service.get_by_email_and_project(
db_session=db_session, email=user.email, project_id=signal.project.id
# only log if something changed
if updates:
individual = (
individual_service.get_by_email_and_project(
db_session=db_session, email=user.email, project_id=signal.project.id
)
if user
else None
)

event_service.log_signal_event(
db_session=db_session,
source="Dispatch Core App",
description="Signal updated",
details=updates,
individual_id=individual.id if individual else None,
dispatch_user_id=user.id if user else None,
signal_id=signal.id,
owner=user.email if user else None,
pinned=True,
)
else:
individual = None

event_service.log_signal_event(
db_session=db_session,
source="Dispatch Core App",
description="Signal updated",
details=updates,
individual_id=individual.id if individual else None,
dispatch_user_id=user.id if user else None,
signal_id=signal.id,
owner=user.email if user else None,
pinned=True,
)
return signal


Expand Down

0 comments on commit c5aed04

Please sign in to comment.