add progress bar for deleting cards

This commit is contained in:
Damien Elmes 2009-02-06 19:30:39 +09:00
parent 4d4e7afcff
commit d35320364a

View file

@ -1052,18 +1052,23 @@ where facts.id not in (select factId from cards)""")
self.s.flush() self.s.flush()
now = time.time() now = time.time()
strids = ids2str(ids) strids = ids2str(ids)
self.startProgress(3)
# grab fact ids # grab fact ids
factIds = self.s.column0("select factId from cards where id in %s" factIds = self.s.column0("select factId from cards where id in %s"
% strids) % strids)
# drop from cards # drop from cards
self.updateProgress(_("Deleting cards..."))
self.s.statement("delete from cards where id in %s" % strids) self.s.statement("delete from cards where id in %s" % strids)
# note deleted # note deleted
self.updateProgress()
data = [{'id': id, 'time': now} for id in ids] data = [{'id': id, 'time': now} for id in ids]
self.s.statements("insert into cardsDeleted values (:id, :time)", data) self.s.statements("insert into cardsDeleted values (:id, :time)", data)
# remove any dangling facts # remove any dangling facts
self.updateProgress()
self.deleteDanglingFacts() self.deleteDanglingFacts()
self.rebuildCounts() self.rebuildCounts()
self.flushMod() self.flushMod()
self.finishProgress()
# Models # Models
########################################################################## ##########################################################################