update card tags after sync, new priority handling

This commit is contained in:
Damien Elmes 2009-02-20 00:12:19 +09:00
parent ebaa37fe55
commit 0b1a135176

View file

@ -131,6 +131,7 @@ class SyncTools(object):
self.postSyncRefresh() self.postSyncRefresh()
# rebuild priorities on server # rebuild priorities on server
cardIds = [x[0] for x in payload['added-cards']] cardIds = [x[0] for x in payload['added-cards']]
self.deck.updateCardTags(cardIds)
self.rebuildPriorities(cardIds, self.serverExcludedTags) self.rebuildPriorities(cardIds, self.serverExcludedTags)
# rebuild due counts # rebuild due counts
self.deck.rebuildCounts(full=False) self.deck.rebuildCounts(full=False)
@ -150,14 +151,13 @@ class SyncTools(object):
self.postSyncRefresh() self.postSyncRefresh()
# rebuild priorities on client # rebuild priorities on client
cardIds = [x[0] for x in reply['added-cards']] cardIds = [x[0] for x in reply['added-cards']]
self.deck.updateCardTags(cardIds)
self.rebuildPriorities(cardIds) self.rebuildPriorities(cardIds)
# rebuild due counts # rebuild due counts
self.deck.rebuildCounts(full=False) self.deck.rebuildCounts(full=False)
def rebuildPriorities(self, cardIds, extraExcludes=[]): def rebuildPriorities(self, cardIds, suspend=[]):
where = "and cards.id in %s" % ids2str(cardIds) self.deck.updatePriorities(cardIds, suspend=suspend)
self.deck.updateAllPriorities(extraExcludes=extraExcludes,
where=where)
def postSyncRefresh(self): def postSyncRefresh(self):
"Flush changes to DB, and reload object associations." "Flush changes to DB, and reload object associations."