mirror of
https://github.com/ankitects/anki.git
synced 2025-09-24 16:56:36 -04:00
catch attempt to set invalid due date on cards
This commit is contained in:
parent
072e93590b
commit
1394b80152
3 changed files with 11 additions and 4 deletions
|
@ -81,8 +81,9 @@ class Card(object):
|
||||||
self.mod = intTime()
|
self.mod = intTime()
|
||||||
self.usn = self.col.usn()
|
self.usn = self.col.usn()
|
||||||
# bug check
|
# bug check
|
||||||
if (self.queue == 2 and self.odue):
|
if self.queue == 2 and self.odue:
|
||||||
warn()
|
warn()
|
||||||
|
assert due < 4294967296
|
||||||
self.col.db.execute(
|
self.col.db.execute(
|
||||||
"""
|
"""
|
||||||
insert or replace into cards values
|
insert or replace into cards values
|
||||||
|
@ -109,9 +110,10 @@ insert or replace into cards values
|
||||||
def flushSched(self):
|
def flushSched(self):
|
||||||
self.mod = intTime()
|
self.mod = intTime()
|
||||||
self.usn = self.col.usn()
|
self.usn = self.col.usn()
|
||||||
# bug check
|
# bug checks
|
||||||
if (self.queue == 2 and self.odue):
|
if self.queue == 2 and self.odue:
|
||||||
warn()
|
warn()
|
||||||
|
assert due < 4294967296
|
||||||
self.col.db.execute(
|
self.col.db.execute(
|
||||||
"""update cards set
|
"""update cards set
|
||||||
mod=?, usn=?, type=?, queue=?, due=?, ivl=?, factor=?, reps=?,
|
mod=?, usn=?, type=?, queue=?, due=?, ivl=?, factor=?, reps=?,
|
||||||
|
|
|
@ -42,7 +42,7 @@ MODEL_STD = 0
|
||||||
MODEL_CLOZE = 1
|
MODEL_CLOZE = 1
|
||||||
|
|
||||||
# deck schema & syncing vars
|
# deck schema & syncing vars
|
||||||
SCHEMA_VERSION = 7
|
SCHEMA_VERSION = 8
|
||||||
SYNC_ZIP_SIZE = int(2.5*1024*1024)
|
SYNC_ZIP_SIZE = int(2.5*1024*1024)
|
||||||
SYNC_URL = os.environ.get("SYNC_URL") or "https://beta.ankiweb.net/sync/"
|
SYNC_URL = os.environ.get("SYNC_URL") or "https://beta.ankiweb.net/sync/"
|
||||||
SYNC_VER = 3
|
SYNC_VER = 3
|
||||||
|
|
|
@ -112,6 +112,11 @@ def _upgrade(col, ver):
|
||||||
"update cards set odue = 0 where (type = 1 or queue = 2) "
|
"update cards set odue = 0 where (type = 1 or queue = 2) "
|
||||||
"and not odid")
|
"and not odid")
|
||||||
col.db.execute("update col set ver = 7")
|
col.db.execute("update col set ver = 7")
|
||||||
|
if ver < 8:
|
||||||
|
col.modSchema()
|
||||||
|
col.db.execute(
|
||||||
|
"update cards set due = due / 1000 where due > 4294967296")
|
||||||
|
col.db.execute("update col set ver = 8")
|
||||||
|
|
||||||
def _upgradeClozeModel(col, m):
|
def _upgradeClozeModel(col, m):
|
||||||
m['type'] = MODEL_CLOZE
|
m['type'] = MODEL_CLOZE
|
||||||
|
|
Loading…
Reference in a new issue