mirror of
https://gitea.mueller.network/extern/django-helpdesk.git
synced 2024-11-22 07:53:19 +01:00
Raise ImproperlyConfigured if HELPDESK_FOLLOWUP_TIME_SPENT_OPENING_HOURS is out of (0, 23.9999) boundary values
This commit is contained in:
parent
02e333cf52
commit
ae7c8c7aea
@ -9,7 +9,7 @@ lib.py - Common functions (eg multipart e-mail)
|
|||||||
|
|
||||||
from datetime import date, datetime, time
|
from datetime import date, datetime, time
|
||||||
from django.conf import settings
|
from django.conf import settings
|
||||||
from django.core.exceptions import ValidationError
|
from django.core.exceptions import ValidationError, ImproperlyConfigured
|
||||||
from django.utils.encoding import smart_str
|
from django.utils.encoding import smart_str
|
||||||
from helpdesk.settings import CUSTOMFIELD_DATE_FORMAT, CUSTOMFIELD_DATETIME_FORMAT, CUSTOMFIELD_TIME_FORMAT
|
from helpdesk.settings import CUSTOMFIELD_DATE_FORMAT, CUSTOMFIELD_DATETIME_FORMAT, CUSTOMFIELD_TIME_FORMAT
|
||||||
import logging
|
import logging
|
||||||
@ -206,7 +206,8 @@ def daily_time_spent_calculation(earliest, latest, open_hours):
|
|||||||
MIDNIGHT = 23.9999
|
MIDNIGHT = 23.9999
|
||||||
start, end = open_hours.get(weekday, (0, MIDNIGHT))
|
start, end = open_hours.get(weekday, (0, MIDNIGHT))
|
||||||
if not 0 <= start <= end <= MIDNIGHT:
|
if not 0 <= start <= end <= MIDNIGHT:
|
||||||
start, end = 0, MIDNIGHT
|
raise ImproperlyConfigured("HELPDESK_FOLLOWUP_TIME_SPENT_OPENING_HOURS"
|
||||||
|
f" setting for {weekday} out of (0, 23.9999) boundary")
|
||||||
|
|
||||||
# transform decimals to minutes and seconds
|
# transform decimals to minutes and seconds
|
||||||
start_hour, start_minute, start_second = int(start), int(start % 1 * 60), int(start * 60 % 1 * 60)
|
start_hour, start_minute, start_second = int(start), int(start % 1 * 60), int(start * 60 % 1 * 60)
|
||||||
|
Loading…
Reference in New Issue
Block a user