From 5482d7b6df23fb86b5850e92e95d14635299c6cd Mon Sep 17 00:00:00 2001 From: Sam Splunks <72095718+samsplunks@users.noreply.github.com> Date: Thu, 15 Feb 2024 15:42:29 +0000 Subject: [PATCH] Adding year to HELPDESK_FOLLOWUP_TIME_SPENT_EXCLUDE_HOLIDAYS dates --- docs/settings.rst | 6 ++---- helpdesk/models.py | 2 +- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/docs/settings.rst b/docs/settings.rst index 4a48875a..df4cb5d0 100644 --- a/docs/settings.rst +++ b/docs/settings.rst @@ -321,11 +321,9 @@ Time Tracking Options **Default:** ``HELPDESK_FOLLOWUP_TIME_SPENT_EXCLUDE_HOLIDAYS = ()`` - This example removes the first and last days of the year together with Christmas:: + This example removes Christmas and New Year's Eve in 2024:: - HELPDESK_FOLLOWUP_TIME_SPENT_EXCLUDE_HOLIDAYS = ("01-01", - "12-25", - "12-31",) + HELPDESK_FOLLOWUP_TIME_SPENT_EXCLUDE_HOLIDAYS = ("2024-12-25", "2024-12-31",) - **HELPDESK_FOLLOWUP_TIME_SPENT_EXCLUDE_STATUSES** List of ticket statuses to exclude from automatic follow-up 'time_spent' calculation. diff --git a/helpdesk/models.py b/helpdesk/models.py index 21c4a555..167745fc 100644 --- a/helpdesk/models.py +++ b/helpdesk/models.py @@ -1046,7 +1046,7 @@ class FollowUp(models.Model): start_day_time = middle_day_time.replace(hour=0, minute=0, second=0) end_day_time = middle_day_time.replace(hour=23, minute=59, second=59) - if (start_day_time.strftime("%m-%d") not in holidays and + if (start_day_time.strftime("%Y-%m-%d") not in holidays and prev_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)