1
0
Fork 0

Show recent imports in a table

This commit is contained in:
Mouse Reeve 2022-11-05 13:11:03 -07:00
parent 4806a6273e
commit 3c2f2c10bf
3 changed files with 56 additions and 14 deletions

View file

@ -1,4 +1,5 @@
""" track progress of goodreads imports """
import math
import re
import dateutil.parser
@ -53,6 +54,12 @@ class ImportJob(models.Model):
"""How many books do you want to import???"""
return self.items.count()
@property
def percent_complete(self):
"""How far along?"""
item_count = self.item_count
return math.floor((item_count - self.pending_item_count) / item_count * 100)
@property
def pending_item_count(self):
"""And how many pending items??"""