Compare commits
2 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
2f778dc4b4 | ||
|
|
e0c165313b |
@@ -61,25 +61,28 @@ def relative_stat_tone(
|
|||||||
|
|
||||||
@register.simple_tag
|
@register.simple_tag
|
||||||
def percent_change_display(start, end):
|
def percent_change_display(start, end):
|
||||||
if start == None or end == None:
|
try:
|
||||||
return SafeString("Δ n/a")
|
if start == None or end == None:
|
||||||
if start == end:
|
return SafeString("Δ n/a")
|
||||||
direction = "Δ "
|
if start == end:
|
||||||
else:
|
direction = "Δ "
|
||||||
direction = "↑ " if end > start else "↓ "
|
|
||||||
|
|
||||||
if start == 0 and end != 0:
|
|
||||||
pct_change = "100%"
|
|
||||||
elif start == 0:
|
|
||||||
pct_change = "0%"
|
|
||||||
else:
|
|
||||||
change = int(round(100 * abs(end - start) / max(start, 1)))
|
|
||||||
if change > 999:
|
|
||||||
return "> 999%"
|
|
||||||
else:
|
else:
|
||||||
pct_change = str(change) + "%"
|
direction = "↑ " if end > start else "↓ "
|
||||||
|
|
||||||
return SafeString(direction + pct_change)
|
if start == 0 and end != 0:
|
||||||
|
pct_change = "100%"
|
||||||
|
elif start == 0:
|
||||||
|
pct_change = "0%"
|
||||||
|
else:
|
||||||
|
change = int(round(100 * abs(end - start) / max(start, 1)))
|
||||||
|
if change > 999:
|
||||||
|
return "> 999%"
|
||||||
|
else:
|
||||||
|
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")
|
@register.inclusion_tag("dashboard/includes/sidebar_footer.html")
|
||||||
|
|||||||
@@ -18,7 +18,7 @@ import urllib.parse as urlparse
|
|||||||
from django.contrib.messages import constants as messages
|
from django.contrib.messages import constants as messages
|
||||||
|
|
||||||
# Increment on new releases
|
# Increment on new releases
|
||||||
VERSION = "v0.7.2"
|
VERSION = "v0.7.3"
|
||||||
|
|
||||||
# Build paths inside the project like this: os.path.join(BASE_DIR, ...)
|
# Build paths inside the project like this: os.path.join(BASE_DIR, ...)
|
||||||
BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
|
BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
|
||||||
|
|||||||
Reference in New Issue
Block a user