feat(core): support negative numbers when Calculating ticket duration for ticket meta and comments

enables time to be subtracted when negative value added to duration field.

ref: #250 #96 #93 #95 #90 #264 #266
This commit is contained in:
2024-09-09 17:59:22 +09:30
parent 44604d98ab
commit aa6baf94a6
2 changed files with 20 additions and 3 deletions

View File

@ -42,10 +42,17 @@ def to_duration(value):
str: Duration value in format 00h 00m 00s
"""
hours = int(int(value)//3600)
hour = int(3600)
minute = int(60)
minutes = int((int(value)%3600)//60)
if '-' in value:
hour = int(-3600)
minute = int(-60)
seconds = int((int(value)%3600)%60)
hours = int(int(value)//hour)
minutes = int((int(value)%hour)//minute)
seconds = int((int(value)%hour)%minute)
return str("{:02d}h {:02d}m {:02d}s".format(hours, minutes, seconds))

View File

@ -821,6 +821,16 @@ class TicketPermissions(
assert action_comment
@pytest.mark.skip(reason='to be written')
def test_ticket_action_comment_project_added(self):
"""Action Comment test
Confirm a 'project added' action comment is created for the ticket
when a project is added
"""
pass
@pytest.mark.skip(reason='to be written')
def test_ticket_action_comment_related_ticket_removed(self):
"""Action Comment test