Commit 27604c44 authored by Sebastien Ponce's avatar Sebastien Ponce
Browse files

Fixed corner case of printPercentage when the given arguments are None

parent f45d77bb
......@@ -578,8 +578,10 @@ def nbToDataAmount(n):
def printPercentage(portion, total):
'''converts portion/total couple to a percentage of completion'''
if total == 0:
if total == 0 or total is None:
return 'N/A'
if portion is None:
portion = 0
perc = portion*100.0/total
return "%.1f %%" % perc
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment