diff --git a/src/dispatch/case/scheduled.py b/src/dispatch/case/scheduled.py index e0685297da02..89513ecf30bd 100644 --- a/src/dispatch/case/scheduled.py +++ b/src/dispatch/case/scheduled.py @@ -10,6 +10,7 @@ from datetime import datetime, date from schedule import every from sqlalchemy.orm import Session +from sqlalchemy import or_ from dispatch.decorators import scheduled_project_task, timer from dispatch.project.models import Project @@ -17,6 +18,7 @@ from .enums import CaseStatus from .messaging import send_case_close_reminder, send_case_triage_reminder +from .models import Case from .service import ( get_all_by_status, ) @@ -31,7 +33,9 @@ def case_close_reminder(db_session: Session, project: Project): """Sends a reminder to the case assignee to close out their case.""" cases = get_all_by_status( - db_session=db_session, project_id=project.id, statuses=[CaseStatus.triage] + db_session=db_session, + project_id=project.id, + statuses=[CaseStatus.triage] ) for case in cases: @@ -52,8 +56,17 @@ def case_close_reminder(db_session: Session, project: Project): @scheduled_project_task def case_triage_reminder(db_session: Session, project: Project): """Sends a reminder to the case assignee to triage their case.""" - cases = get_all_by_status( - db_session=db_session, project_id=project.id, statuses=[CaseStatus.new] + + cases = ( + db_session.query(Case) + .filter(Case.project_id == project.id) + .filter( + or_( + Case.title == "Security Event Triage", + Case.status == CaseStatus.new + ) + ) + .all() ) # if we want more specific SLA reminders, we would need to add additional data model diff --git a/src/dispatch/messaging/strings.py b/src/dispatch/messaging/strings.py index 23736c9c79d4..9e7e73b74512 100644 --- a/src/dispatch/messaging/strings.py +++ b/src/dispatch/messaging/strings.py @@ -323,7 +323,7 @@ class MessageType(DispatchEnum): ).strip() CASE_TRIAGE_REMINDER_DESCRIPTION = """The status of this case hasn't been updated recently. -Please ensure you triage the case based on its priority.""".replace( +Please ensure you triage the case based on its priority and update its title, priority, severity and tags.""".replace( "\n", " " ).strip()