diff --git a/src/dispatch/feedback/service/messaging.py b/src/dispatch/feedback/service/messaging.py index 38a01804da6c..57e69012642d 100644 --- a/src/dispatch/feedback/service/messaging.py +++ b/src/dispatch/feedback/service/messaging.py @@ -22,7 +22,7 @@ def send_oncall_shift_feedback_message( *, project: Project, individual: IndividualContact, - schedule_id: str, + service_id: str, shift_end_at: str, schedule_name: str, reminder: Optional[ServiceFeedbackReminder] = None, @@ -64,7 +64,7 @@ def send_oncall_shift_feedback_message( reminder_at=datetime.utcnow() + timedelta(hours=23), individual_contact_id=individual.id, project_id=project.id, - schedule_id=schedule_id, + schedule_id=service_id, schedule_name=schedule_name, shift_end_at=shift_end_at, details=[] if details is None else details, @@ -75,7 +75,7 @@ def send_oncall_shift_feedback_message( items = [ { "individual_name": individual.name, - "oncall_schedule_id": schedule_id, + "oncall_schedule_id": service_id, "oncall_service_name": schedule_name, "organization_slug": project.organization.slug, "project_id": project.id, diff --git a/src/dispatch/feedback/service/scheduled.py b/src/dispatch/feedback/service/scheduled.py index 11cb42078384..97aac76cc38a 100644 --- a/src/dispatch/feedback/service/scheduled.py +++ b/src/dispatch/feedback/service/scheduled.py @@ -2,7 +2,8 @@ import logging from datetime import datetime -from dispatch.database.core import SessionLocal +from sqlalchemy.orm import Session + from dispatch.decorators import scheduled_project_task, timer from dispatch.individual import service as individual_service from dispatch.plugin import service as plugin_service @@ -30,7 +31,7 @@ @scheduler.add(every(1).day.at("16:00"), name="oncall-shift-feedback-ucan") @timer @scheduled_project_task -def oncall_shift_feedback_ucan(db_session: SessionLocal, project: Project): +def oncall_shift_feedback_ucan(db_session: Session, project: Project): oncall_shift_feedback(db_session=db_session, project=project, hour=16) find_expired_reminders_and_send(db_session=db_session, project=project) @@ -38,12 +39,12 @@ def oncall_shift_feedback_ucan(db_session: SessionLocal, project: Project): @scheduler.add(every(1).day.at("06:00"), name="oncall-shift-feedback-emea") @timer @scheduled_project_task -def oncall_shift_feedback_emea(db_session: SessionLocal, project: Project): +def oncall_shift_feedback_emea(db_session: Session, project: Project): oncall_shift_feedback(db_session=db_session, project=project, hour=6) find_expired_reminders_and_send(db_session=db_session, project=project) -def find_expired_reminders_and_send(*, db_session: SessionLocal, project: Project): +def find_expired_reminders_and_send(*, db_session: Session, project: Project): reminders = reminder_service.get_all_expired_reminders_by_project_id( db_session=db_session, project_id=project.id ) @@ -54,7 +55,7 @@ def find_expired_reminders_and_send(*, db_session: SessionLocal, project: Projec send_oncall_shift_feedback_message( project=project, individual=individual, - schedule_id=reminder.schedule_id, + service_id=reminder.schedule_id, shift_end_at=str(reminder.shift_end_at), schedule_name=reminder.schedule_name, reminder=reminder, @@ -65,10 +66,11 @@ def find_expired_reminders_and_send(*, db_session: SessionLocal, project: Projec def find_schedule_and_send( *, - db_session: SessionLocal, + db_session: Session, project: Project, oncall_plugin: PluginInstance, schedule_id: str, + service_id: str, hour: int, ): """ @@ -133,7 +135,7 @@ def count_active_participants(participants): send_oncall_shift_feedback_message( project=project, individual=individual, - schedule_id=schedule_id, + service_id=service_id, shift_end_at=current_oncall["shift_end"], schedule_name=current_oncall["schedule_name"], details=details, @@ -141,7 +143,7 @@ def count_active_participants(participants): ) -def oncall_shift_feedback(db_session: SessionLocal, project: Project, hour: int): +def oncall_shift_feedback(db_session: Session, project: Project, hour: int): """ Experimental: collects feedback from individuals participating in an oncall service that has health metrics enabled when their oncall shift ends. For now, only for one project and schedule. @@ -174,5 +176,6 @@ def oncall_shift_feedback(db_session: SessionLocal, project: Project, hour: int) project=project, oncall_plugin=oncall_plugin, schedule_id=schedule_id, + service_id=external_id, hour=hour, ) diff --git a/src/dispatch/static/dispatch/src/feedback/service/TableFilterDialog.vue b/src/dispatch/static/dispatch/src/feedback/service/TableFilterDialog.vue index 66bb88d9885c..d96700d8bc85 100644 --- a/src/dispatch/static/dispatch/src/feedback/service/TableFilterDialog.vue +++ b/src/dispatch/static/dispatch/src/feedback/service/TableFilterDialog.vue @@ -14,7 +14,12 @@ - + diff --git a/src/dispatch/static/dispatch/src/service/ServiceSelect.vue b/src/dispatch/static/dispatch/src/service/ServiceSelect.vue index 876a7a425495..0f16fe4ce0fa 100644 --- a/src/dispatch/static/dispatch/src/service/ServiceSelect.vue +++ b/src/dispatch/static/dispatch/src/service/ServiceSelect.vue @@ -16,12 +16,17 @@ chips multiple closable-chips - /> + > +