diff --git a/docs/settings.rst b/docs/settings.rst index e332a7ad..4a48875a 100644 --- a/docs/settings.rst +++ b/docs/settings.rst @@ -335,6 +335,14 @@ Time Tracking Options HELPDESK_FOLLOWUP_TIME_SPENT_EXCLUDE_STATUSES = (HELPDESK_TICKET_RESOLVED_STATUS,) +- **HELPDESK_FOLLOWUP_TIME_SPENT_EXCLUDE_QUEUES** List of ticket queues slugs to exclude from automatic follow-up 'time_spent' calculation. + + **Default:** ``HELPDESK_FOLLOWUP_TIME_SPENT_EXCLUDE_QUEUES = ()`` + + This example will have follow-ups to ticket queue 'time-not-counting-queue' not to be counted in:: + + HELPDESK_FOLLOWUP_TIME_SPENT_EXCLUDE_QUEUES = ('time-not-counting-queue',) + Staff Ticket Creation Settings ------------------------------ diff --git a/helpdesk/models.py b/helpdesk/models.py index 9d07ce71..d7bd9521 100644 --- a/helpdesk/models.py +++ b/helpdesk/models.py @@ -1027,6 +1027,7 @@ class FollowUp(models.Model): open_hours = helpdesk_settings.FOLLOWUP_TIME_SPENT_OPENING_HOURS holidays = helpdesk_settings.FOLLOWUP_TIME_SPENT_EXCLUDE_HOLIDAYS exclude_statuses = helpdesk_settings.FOLLOWUP_TIME_SPENT_EXCLUDE_STATUSES + exclude_queues = helpdesk_settings.FOLLOWUP_TIME_SPENT_EXCLUDE_QUEUES # split time interval by days days = latest.toordinal() - earliest.toordinal() @@ -1047,7 +1048,8 @@ class FollowUp(models.Model): end_day_time = middle_day_time.replace(hour=23, minute=59, second=59) if start_day_time.strftime("%m-%d") not in holidays: - if self.ticket.status not in exclude_statuses: + if (self.ticket.status not in exclude_statuses and + self.ticket.queue.slug not in exclude_queues): time_spent_seconds += daily_time_spent_calculation(start_day_time, end_day_time, open_hours) return datetime.timedelta(seconds=time_spent_seconds) diff --git a/helpdesk/settings.py b/helpdesk/settings.py index a74ef3fa..995081f6 100644 --- a/helpdesk/settings.py +++ b/helpdesk/settings.py @@ -176,6 +176,11 @@ FOLLOWUP_TIME_SPENT_EXCLUDE_STATUSES = getattr(settings, 'HELPDESK_FOLLOWUP_TIME_SPENT_EXCLUDE_STATUSES', ()) +# Time doesn't count for listed queues slugs +FOLLOWUP_TIME_SPENT_EXCLUDE_QUEUES = getattr(settings, + 'HELPDESK_FOLLOWUP_TIME_SPENT_EXCLUDE_QUEUES', + ()) + ############################ # options for public pages # ############################