mirror of
https://gitea.mueller.network/extern/django-helpdesk.git
synced 2024-11-21 23:43:11 +01:00
Adding HELPDESK_FOLLOWUP_TIME_CALCULATION_EXCLUDE_STATUSES setting
This commit is contained in:
parent
220f6d56a8
commit
90666a47ba
@ -327,6 +327,14 @@ Time Tracking Options
|
||||
"12-25",
|
||||
"12-31",)
|
||||
|
||||
- **HELPDESK_FOLLOWUP_TIME_CALCULATION_EXCLUDE_STATUSES** List of ticket statuses to exclude from automatic follow-up 'time_spent' calculation.
|
||||
|
||||
**Default:** ``HELPDESK_FOLLOWUP_TIME_CALCULATION_EXCLUDE_STATUSES = ()``
|
||||
|
||||
This example will have follow-ups to resolved ticket status not to be counted in::
|
||||
|
||||
HELPDESK_FOLLOWUP_TIME_CALCULATION_EXCLUDE_STATUSES = (HELPDESK_TICKET_RESOLVED_STATUS,)
|
||||
|
||||
Staff Ticket Creation Settings
|
||||
------------------------------
|
||||
|
||||
|
@ -1026,6 +1026,7 @@ class FollowUp(models.Model):
|
||||
time_spent_seconds = 0
|
||||
open_hours = helpdesk_settings.FOLLOWUP_TIME_SPENT_OPENING_HOURS
|
||||
holidays = helpdesk_settings.FOLLOWUP_TIME_SPENT_EXCLUDE_HOLIDAYS
|
||||
exclude_statuses = helpdesk_settings.FOLLOWUP_TIME_CALCULATION_EXCLUDE_STATUSES
|
||||
|
||||
# split time interval by days
|
||||
days = latest.toordinal() - earliest.toordinal()
|
||||
@ -1046,7 +1047,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:
|
||||
time_spent_seconds += daily_time_spent_calculation(start_day_time, end_day_time, open_hours)
|
||||
if self.ticket.status not in exclude_statuses:
|
||||
time_spent_seconds += daily_time_spent_calculation(start_day_time, end_day_time, open_hours)
|
||||
|
||||
return datetime.timedelta(seconds=time_spent_seconds)
|
||||
|
||||
|
@ -167,10 +167,15 @@ FOLLOWUP_TIME_SPENT_OPENING_HOURS = getattr(settings,
|
||||
{})
|
||||
|
||||
# Holidays don't count for time_spent calculation
|
||||
FOLLOWUP_TIME_SPENT_EXCLUDE_HOLIDAYS= getattr(settings,
|
||||
FOLLOWUP_TIME_SPENT_EXCLUDE_HOLIDAYS = getattr(settings,
|
||||
'HELPDESK_FOLLOWUP_TIME_SPENT_EXCLUDE_HOLIDAYS',
|
||||
())
|
||||
|
||||
# Time doesn't count for listed ticket statuses
|
||||
FOLLOWUP_TIME_CALCULATION_EXCLUDE_STATUSES = getattr(settings,
|
||||
'HELPDESK_FOLLOWUP_TIME_CALCULATION_EXCLUDE_STATUSES',
|
||||
())
|
||||
|
||||
############################
|
||||
# options for public pages #
|
||||
############################
|
||||
|
Loading…
Reference in New Issue
Block a user