mirror of
https://github.com/bookwyrm-social/bookwyrm.git
synced 2024-11-27 03:51:08 +00:00
Avoid divide by zero error
This commit is contained in:
parent
3c2f2c10bf
commit
9cfcad20e0
1 changed files with 2 additions and 0 deletions
|
@ -58,6 +58,8 @@ class ImportJob(models.Model):
|
||||||
def percent_complete(self):
|
def percent_complete(self):
|
||||||
"""How far along?"""
|
"""How far along?"""
|
||||||
item_count = self.item_count
|
item_count = self.item_count
|
||||||
|
if not item_count:
|
||||||
|
return 0
|
||||||
return math.floor((item_count - self.pending_item_count) / item_count * 100)
|
return math.floor((item_count - self.pending_item_count) / item_count * 100)
|
||||||
|
|
||||||
@property
|
@property
|
||||||
|
|
Loading…
Reference in a new issue