fix_duecounts_not_equal_due_to_diff_deck_selection

This commit is contained in:
dobefore 2021-10-01 22:17:36 +08:00 committed by Vikash Kothary
parent 619f0722ee
commit c7b1c0c358
2 changed files with 8 additions and 9 deletions

View File

@ -121,10 +121,7 @@ select id from notes where mid = ?) limit 1"""
return True return True
def sanityCheck(self): def sanityCheck(self):
# basicCheck() seems to have no effect on this procedure,
# if necessary remove comment
# if not self.basicCheck():
# return "failed basic check"
tables=["cards", tables=["cards",
"notes", "notes",
"revlog", "revlog",
@ -137,13 +134,15 @@ select id from notes where mid = ?) limit 1"""
for tb in tables: for tb in tables:
if self.col.db.scalar(f'select null from {tb} where usn=-1'): if self.col.db.scalar(f'select null from {tb} where usn=-1'):
return f'table had usn=-1: {tb}' return f'table had usn=-1: {tb}'
self.col.sched.reset() self.col.sched.reset()
# check for missing parent decks
#self.col.sched.deckDueList()
# return summary of deck # return summary of deck
# make sched.counts() equal to default [0,0,0]
# to make sure sync normally if sched.counts()
# are not equal between different clients due to
# different deck selection
return [ return [
list(self.col.sched.counts()), list([0,0,0]),
self.col.db.scalar("select count() from cards"), self.col.db.scalar("select count() from cards"),
self.col.db.scalar("select count() from notes"), self.col.db.scalar("select count() from notes"),
self.col.db.scalar("select count() from revlog"), self.col.db.scalar("select count() from revlog"),

View File

@ -136,8 +136,8 @@ class SyncCollectionHandler(Syncer):
return lchg return lchg
def sanityCheck2(self, client): def sanityCheck2(self, client):
client[0]=[0,0,0]
server = self.sanityCheck() server = self.sanityCheck()
status="ok"
if client != server: if client != server:
logger.info( logger.info(
f"sanity check failed with server: {server} client: {client}" f"sanity check failed with server: {server} client: {client}"