Fix IndexError for new cards with areDue / getIntervals
This commit is contained in:
parent
a6c15d7bb2
commit
64c61a32fa
@ -416,12 +416,11 @@ class AnkiBridge:
|
|||||||
def areDue(self, cards):
|
def areDue(self, cards):
|
||||||
due = []
|
due = []
|
||||||
for card in cards:
|
for card in cards:
|
||||||
date, ivl = self.collection().db.all('select id/1000.0, ivl from revlog where cid = ?', card)[-1]
|
|
||||||
|
|
||||||
if self.findCards('cid:%s is:new' % card):
|
if self.findCards('cid:%s is:new' % card):
|
||||||
due.append(True)
|
due.append(True)
|
||||||
continue
|
continue
|
||||||
|
|
||||||
|
date, ivl = self.collection().db.all('select id/1000.0, ivl from revlog where cid = ?', card)[-1]
|
||||||
if (ivl >= -1200):
|
if (ivl >= -1200):
|
||||||
if self.findCards('cid:%s is:due' % card):
|
if self.findCards('cid:%s is:due' % card):
|
||||||
due.append(True)
|
due.append(True)
|
||||||
@ -439,6 +438,10 @@ class AnkiBridge:
|
|||||||
def getIntervals(self, cards, complete=False):
|
def getIntervals(self, cards, complete=False):
|
||||||
intervals = []
|
intervals = []
|
||||||
for card in cards:
|
for card in cards:
|
||||||
|
if self.findCards('cid:%s is:new' % card):
|
||||||
|
intervals.append(0)
|
||||||
|
continue
|
||||||
|
|
||||||
interval = self.collection().db.list('select ivl from revlog where cid = ?', card)
|
interval = self.collection().db.list('select ivl from revlog where cid = ?', card)
|
||||||
if not complete:
|
if not complete:
|
||||||
interval = interval[-1]
|
interval = interval[-1]
|
||||||
|
Loading…
Reference in New Issue
Block a user