Skip to content

Commit

Permalink
Fix division by zero error when time quota is set to 0 (#4375)
Browse files Browse the repository at this point in the history
Co-authored-by: Jiani Wang <[email protected]>
Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
  • Loading branch information
3 people authored Mar 1, 2023
1 parent d33626f commit dd9c442
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion codalab/lib/formatting.py
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ def ratio_str(to_str, a, b):
"""
Example: to_str = duration_str, a = 60, b = 120 => "1m / 2m (50%)"
"""
return '%s / %s (%.1f%%)' % (to_str(a), to_str(b), 100.0 * a / b)
return '%s / %s (%.1f%%)' % (to_str(a), to_str(b), 100.0 * a / b if b != 0 else 100.0)


def parse_size(s):
Expand Down

0 comments on commit dd9c442

Please sign in to comment.