Removed duplicate format_time_spent function definition

This commit is contained in:
Sam Splunks 2024-02-15 09:30:02 +00:00
parent cec1035c2d
commit ae89d182a9
2 changed files with 4 additions and 16 deletions

View File

@ -173,11 +173,10 @@ def format_time_spent(time_spent):
"""Format time_spent attribute to "[H]HHh:MMm" text string to be allign in
all graphical outputs
"""
if time_spent:
time_spent = "{0:02d}h:{1:02d}m".format(
time_spent.seconds // 3600,
time_spent.seconds // 60
int(time_spent.total_seconds()) // 3600,
int(time_spent.total_seconds()) % 3600 // 60
)
else:
time_spent = ""

View File

@ -8,7 +8,7 @@ models.py - Model (and hence database) definitions. This is the core of the
"""
from .lib import convert_value, daily_time_spent_calculation
from .lib import format_time_spent, convert_value, daily_time_spent_calculation
from .templated_email import send_templated_mail
from .validators import validate_file_extension
from .webhooks import send_new_ticket_webhook
@ -33,17 +33,6 @@ from rest_framework import serializers
import uuid
def format_time_spent(time_spent):
if time_spent:
time_spent = "{0:02d}h:{1:02d}m".format(
int(time_spent.total_seconds()) // 3600,
int(time_spent.total_seconds()) % 3600 // 60
)
else:
time_spent = ""
return time_spent
class EscapeHtml(Extension):
def extendMarkdown(self, md):
md.preprocessors.deregister('html_block')