Factorizing card's flush
This commit is contained in:
parent
b2ef003207
commit
81daad878e
@ -84,7 +84,7 @@ class Card:
|
|||||||
self._render_output = None
|
self._render_output = None
|
||||||
self._note = None
|
self._note = None
|
||||||
|
|
||||||
def flush(self) -> None:
|
def _preFlush(self) -> none:
|
||||||
self.mod = intTime()
|
self.mod = intTime()
|
||||||
self.usn = self.col.usn()
|
self.usn = self.col.usn()
|
||||||
# bug check
|
# bug check
|
||||||
@ -95,6 +95,9 @@ class Card:
|
|||||||
):
|
):
|
||||||
hooks.card_odue_was_invalid()
|
hooks.card_odue_was_invalid()
|
||||||
assert self.due < 4294967296
|
assert self.due < 4294967296
|
||||||
|
|
||||||
|
def flush(self) -> None:
|
||||||
|
self._preFlush()
|
||||||
self.col.db.execute(
|
self.col.db.execute(
|
||||||
"""
|
"""
|
||||||
insert or replace into cards values
|
insert or replace into cards values
|
||||||
@ -121,16 +124,8 @@ insert or replace into cards values
|
|||||||
self.col.log(self)
|
self.col.log(self)
|
||||||
|
|
||||||
def flushSched(self) -> None:
|
def flushSched(self) -> None:
|
||||||
self.mod = intTime()
|
self._preFlush()
|
||||||
self.usn = self.col.usn()
|
|
||||||
# bug checks
|
# bug checks
|
||||||
if (
|
|
||||||
self.queue == QUEUE_TYPE_REV
|
|
||||||
and self.odue
|
|
||||||
and not self.col.decks.isDyn(self.did)
|
|
||||||
):
|
|
||||||
hooks.card_odue_was_invalid()
|
|
||||||
assert self.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=?,
|
||||||
|
Loading…
Reference in New Issue
Block a user