Fix duration change being unknown (fixes #89)
This commit is contained in:
parent
2f778dc4b4
commit
6d7292a60a
@ -1,3 +1,4 @@
|
||||
from datetime import timedelta
|
||||
from urllib.parse import urlparse
|
||||
|
||||
import flag
|
||||
@ -61,7 +62,6 @@ def relative_stat_tone(
|
||||
|
||||
@register.simple_tag
|
||||
def percent_change_display(start, end):
|
||||
try:
|
||||
if start == None or end == None:
|
||||
return SafeString("Δ n/a")
|
||||
if start == end:
|
||||
@ -81,8 +81,6 @@ def percent_change_display(start, end):
|
||||
pct_change = str(change) + "%"
|
||||
|
||||
return SafeString(direction + pct_change)
|
||||
except: # TODO: filter for specific issues
|
||||
return SafeString("Δ ?")
|
||||
|
||||
|
||||
@register.inclusion_tag("dashboard/includes/sidebar_footer.html")
|
||||
@ -100,6 +98,12 @@ def compare(
|
||||
bad_classes=None,
|
||||
neutral_classes=None,
|
||||
):
|
||||
if isinstance(start, timedelta):
|
||||
start = start.seconds
|
||||
|
||||
if isinstance(end, timedelta):
|
||||
end = end.seconds
|
||||
|
||||
return {
|
||||
"start": start,
|
||||
"end": end,
|
||||
|
Loading…
Reference in New Issue
Block a user