You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Inside of the duration function, used to describe the time_spent attribute on the events tab, it takes in a value which is interpreted as a second at the beginning and then is divided by 60 for some reason down below:
@register.filter
def duration(value):
if not value:
return '0s'
hours, minutes, seconds = 0, 0, 0
if value > 3600:
hours = value / 3600
value = value % 3600
if value > 60:
minutes = value / 60
value = value % 60
seconds = value / 60
output = []
if hours:
output.append('%dh' % hours)
if minutes:
output.append('%dm' % minutes)
if seconds > 1:
output.append('%0.2fs' % seconds)
elif seconds:
output.append('%dms' % (seconds * 1000))
return ''.join(output)
The culprit is the line "seconds = value / 60", as at this point it seems to already be in seconds. For instance, if you pass the value 1 in ( I'm assuming it's 1s ) , the interface would display 16ms , which I don't believe is correct unless the original value is supposed to be something else that I can't figure out.
The text was updated successfully, but these errors were encountered:
Inside of the duration function, used to describe the time_spent attribute on the events tab, it takes in a value which is interpreted as a second at the beginning and then is divided by 60 for some reason down below:
@register.filter
def duration(value):
if not value:
return '0s'
hours, minutes, seconds = 0, 0, 0
if value > 3600:
hours = value / 3600
value = value % 3600
if value > 60:
minutes = value / 60
value = value % 60
seconds = value / 60
output = []
if hours:
output.append('%dh' % hours)
if minutes:
output.append('%dm' % minutes)
if seconds > 1:
output.append('%0.2fs' % seconds)
elif seconds:
output.append('%dms' % (seconds * 1000))
return ''.join(output)
The culprit is the line "seconds = value / 60", as at this point it seems to already be in seconds. For instance, if you pass the value 1 in ( I'm assuming it's 1s ) , the interface would display 16ms , which I don't believe is correct unless the original value is supposed to be something else that I can't figure out.
The text was updated successfully, but these errors were encountered: