Skip to content
This repository has been archived by the owner on Apr 25, 2023. It is now read-only.

Commit

Permalink
Progress bar tag: Don't blow on invalid data
Browse files Browse the repository at this point in the history
Instead of throwing an exception, returning 500 for the entire page, shows N/A
  • Loading branch information
MeirKriheli committed Sep 2, 2015
1 parent 3a1631d commit d6cc645
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion auxiliary/templatetags/common_visual_elements.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@ def bar(quantity, start, end, bar_class=None, show_label=True):
:param show_label: Show the descriptive label ?
"""

assert quantity <= end, "bar: quantity > end"
if quantity > end:
return {'applicable': False}

try:
value = (quantity - start) * 100 / (end - start)
Expand Down

0 comments on commit d6cc645

Please sign in to comment.