diff --git a/backend/notifications/models.py b/backend/notifications/models.py index f5a7edb..ed0d8f4 100644 --- a/backend/notifications/models.py +++ b/backend/notifications/models.py @@ -148,7 +148,9 @@ class Notifications(SQLModel, table=True): skip: int = 0, ): statement = select(cls).where( - cls.user_id == user_id, cls.is_deleted == False # noqa: E712 + cls.user_id == user_id, + cls.is_deleted == False, # noqa: E712 + cls.title != "ATS score ready", ) if unread_only: statement = statement.where(cls.is_read == False) # noqa: E712 @@ -158,6 +160,7 @@ class Notifications(SQLModel, table=True): cls.user_id == user_id, cls.is_deleted == False, # noqa: E712 cls.is_read == False, # noqa: E712 + cls.title != "ATS score ready", ) unread = (await session.execute(unread_statement)).scalar_one() statement = statement.order_by(cls.created_at.desc()) diff --git a/backend/notifications/views.py b/backend/notifications/views.py index 58934b5..472e373 100644 --- a/backend/notifications/views.py +++ b/backend/notifications/views.py @@ -29,7 +29,7 @@ from users.models import Users logger = logging.getLogger(__name__) -# Candidate-history event_type → in-app kind, title, and profile tab. +_SILENT_HISTORY_EVENTS = frozenset({"ats.scored"}) _HISTORY_KIND = { "stage.changed": "application", "candidate.created": "application", @@ -432,6 +432,8 @@ async def notify_candidate_history( """One in-app row per job stakeholder for a candidate_history write.""" if row is None: return [] + if row.event_type in _SILENT_HISTORY_EVENTS: + return [] try: from job.job_post.models import JobPosts