mirror of
https://github.com/ankitects/anki.git
synced 2025-09-25 01:06:35 -04:00
catch incorrect ordinals on upgrade
This commit is contained in:
parent
cd76706a2f
commit
bd29318168
2 changed files with 18 additions and 12 deletions
|
@ -21,7 +21,7 @@ class CardStats(object):
|
||||||
def report(self):
|
def report(self):
|
||||||
c = self.card
|
c = self.card
|
||||||
fmt = lambda x, **kwargs: fmtTimeSpan(x, short=True, **kwargs)
|
fmt = lambda x, **kwargs: fmtTimeSpan(x, short=True, **kwargs)
|
||||||
self.txt = "<table width=100%%>"
|
self.txt = "<table width=100%>"
|
||||||
self.addLine(_("Added"), self.date(c.id/1000))
|
self.addLine(_("Added"), self.date(c.id/1000))
|
||||||
first = self.col.db.scalar(
|
first = self.col.db.scalar(
|
||||||
"select min(id) from revlog where cid = ?", c.id)
|
"select min(id) from revlog where cid = ?", c.id)
|
||||||
|
|
|
@ -84,6 +84,12 @@ analyze;""")
|
||||||
cardModels cm, facts f where cm.modelId = f.modelId and
|
cardModels cm, facts f where cm.modelId = f.modelId and
|
||||||
f.id = cards.factId)"""):
|
f.id = cards.factId)"""):
|
||||||
return
|
return
|
||||||
|
# cards with the wrong ordinal?
|
||||||
|
if db.list("""
|
||||||
|
select c.id from cards c, cardModels cm
|
||||||
|
where c.cardModelId = cm.id
|
||||||
|
and c.ordinal != cm.ordinal"""):
|
||||||
|
return
|
||||||
# facts missing a card?
|
# facts missing a card?
|
||||||
if db.list("""
|
if db.list("""
|
||||||
select facts.id from facts
|
select facts.id from facts
|
||||||
|
|
Loading…
Reference in a new issue