mirror of
https://github.com/ankitects/anki.git
synced 2025-09-21 07:22:23 -04:00
add refs to relativeDelay again
This commit is contained in:
parent
6cb968c10a
commit
e9dc034b9a
4 changed files with 12 additions and 8 deletions
|
@ -62,6 +62,7 @@ cardsTable = Table(
|
||||||
Column('spaceUntil', Float, nullable=False, default=0),
|
Column('spaceUntil', Float, nullable=False, default=0),
|
||||||
Column('isDue', Boolean, nullable=False, default=0),
|
Column('isDue', Boolean, nullable=False, default=0),
|
||||||
Column('type', Integer, nullable=False, default=2),
|
Column('type', Integer, nullable=False, default=2),
|
||||||
|
Column('relativeDelay', Float, nullable=False, default=0), # obsolete
|
||||||
Column('combinedDue', Integer, nullable=False, default=0))
|
Column('combinedDue', Integer, nullable=False, default=0))
|
||||||
|
|
||||||
class Card(object):
|
class Card(object):
|
||||||
|
@ -75,6 +76,9 @@ class Card(object):
|
||||||
self.isDue = True
|
self.isDue = True
|
||||||
self.timerStarted = False
|
self.timerStarted = False
|
||||||
self.timerStopped = False
|
self.timerStopped = False
|
||||||
|
self.modified = time.time()
|
||||||
|
self.due = self.modified
|
||||||
|
self.combinedDue = self.modified
|
||||||
if fact:
|
if fact:
|
||||||
self.fact = fact
|
self.fact = fact
|
||||||
if cardModel:
|
if cardModel:
|
||||||
|
@ -248,7 +252,8 @@ noCount=:noCount,
|
||||||
spaceUntil = :spaceUntil,
|
spaceUntil = :spaceUntil,
|
||||||
isDue = :isDue,
|
isDue = :isDue,
|
||||||
type = :type,
|
type = :type,
|
||||||
combinedDue = max(:spaceUntil, :due)
|
combinedDue = max(:spaceUntil, :due),
|
||||||
|
relativeDelay = 0
|
||||||
where id=:id""", self.__dict__)
|
where id=:id""", self.__dict__)
|
||||||
|
|
||||||
mapper(Card, cardsTable, properties={
|
mapper(Card, cardsTable, properties={
|
||||||
|
@ -260,8 +265,6 @@ mapper(Card, cardsTable, properties={
|
||||||
mapper(Fact, factsTable, properties={
|
mapper(Fact, factsTable, properties={
|
||||||
'model': relation(Model),
|
'model': relation(Model),
|
||||||
'fields': relation(Field, backref="fact", order_by=Field.c.ordinal),
|
'fields': relation(Field, backref="fact", order_by=Field.c.ordinal),
|
||||||
'lastCard': relation(Card, post_update=True, primaryjoin=
|
|
||||||
cardsTable.c.id == factsTable.c.lastCardId),
|
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -305,7 +305,7 @@ end)""" + where)
|
||||||
"select count(*) from failedCardsSoon")
|
"select count(*) from failedCardsSoon")
|
||||||
self.revCount = self.s.scalar("select count(*) from revCards")
|
self.revCount = self.s.scalar("select count(*) from revCards")
|
||||||
self.newCount = self.s.scalar("select count(*) from acqCardsOrdered")
|
self.newCount = self.s.scalar("select count(*) from acqCardsOrdered")
|
||||||
print "rebuild counts", time.time() - t
|
#print "rebuild counts", time.time() - t
|
||||||
|
|
||||||
def checkDue(self):
|
def checkDue(self):
|
||||||
"Mark expired cards due, and update counts."
|
"Mark expired cards due, and update counts."
|
||||||
|
|
|
@ -526,7 +526,8 @@ priority, interval, lastInterval, due, lastDue, factor,
|
||||||
firstAnswered, reps, successive, averageTime, reviewTime, youngEase0,
|
firstAnswered, reps, successive, averageTime, reviewTime, youngEase0,
|
||||||
youngEase1, youngEase2, youngEase3, youngEase4, matureEase0,
|
youngEase1, youngEase2, youngEase3, youngEase4, matureEase0,
|
||||||
matureEase1, matureEase2, matureEase3, matureEase4, yesCount, noCount,
|
matureEase1, matureEase2, matureEase3, matureEase4, yesCount, noCount,
|
||||||
question, answer, lastFactor, spaceUntil, isDue, type, combinedDue)
|
question, answer, lastFactor, spaceUntil, isDue, type, combinedDue,
|
||||||
|
relativeDelay)
|
||||||
values
|
values
|
||||||
(:id, :factId, :cardModelId, :created, :modified, :tags, :ordinal,
|
(:id, :factId, :cardModelId, :created, :modified, :tags, :ordinal,
|
||||||
:priority, :interval, :lastInterval, :due, :lastDue, :factor,
|
:priority, :interval, :lastInterval, :due, :lastDue, :factor,
|
||||||
|
@ -534,7 +535,7 @@ values
|
||||||
:youngEase1, :youngEase2, :youngEase3, :youngEase4, :matureEase0,
|
:youngEase1, :youngEase2, :youngEase3, :youngEase4, :matureEase0,
|
||||||
:matureEase1, :matureEase2, :matureEase3, :matureEase4, :yesCount,
|
:matureEase1, :matureEase2, :matureEase3, :matureEase4, :yesCount,
|
||||||
:noCount, :question, :answer, :lastFactor, :spaceUntil, :isDue,
|
:noCount, :question, :answer, :lastFactor, :spaceUntil, :isDue,
|
||||||
:type, :combinedDue)""", dlist)
|
:type, :combinedDue, 0)""", dlist)
|
||||||
self.deck.s.statement(
|
self.deck.s.statement(
|
||||||
"delete from cardsDeleted where cardId in %s" %
|
"delete from cardsDeleted where cardId in %s" %
|
||||||
ids2str([c[0] for c in cards]))
|
ids2str([c[0] for c in cards]))
|
||||||
|
@ -802,7 +803,8 @@ priority, interval, lastInterval, due, lastDue, factor,
|
||||||
firstAnswered, reps, successive, averageTime, reviewTime, youngEase0,
|
firstAnswered, reps, successive, averageTime, reviewTime, youngEase0,
|
||||||
youngEase1, youngEase2, youngEase3, youngEase4, matureEase0,
|
youngEase1, youngEase2, youngEase3, youngEase4, matureEase0,
|
||||||
matureEase1, matureEase2, matureEase3, matureEase4, yesCount, noCount,
|
matureEase1, matureEase2, matureEase3, matureEase4, yesCount, noCount,
|
||||||
question, answer, lastFactor, spaceUntil, isDue, type, combinedDue)
|
question, answer, lastFactor, spaceUntil, isDue, type, combinedDue,
|
||||||
|
relativeDelay)
|
||||||
values
|
values
|
||||||
(:id, :factId, :cardModelId, :created, :t, "", :ordinal,
|
(:id, :factId, :cardModelId, :created, :t, "", :ordinal,
|
||||||
1, 0, 0, :created, 0, 2.5,
|
1, 0, 0, :created, 0, 2.5,
|
||||||
|
|
|
@ -41,7 +41,6 @@ def test_export_anki():
|
||||||
e.limitTags = ['tag']
|
e.limitTags = ['tag']
|
||||||
e.exportInto(newname)
|
e.exportInto(newname)
|
||||||
d2 = DeckStorage.Deck(newname)
|
d2 = DeckStorage.Deck(newname)
|
||||||
print d2.cardCount
|
|
||||||
assert d2.cardCount == 2
|
assert d2.cardCount == 2
|
||||||
|
|
||||||
@nose.with_setup(setup1)
|
@nose.with_setup(setup1)
|
||||||
|
|
Loading…
Reference in a new issue