(self, search, order=False)
return ids
Find all cards that are scheduled for today
Find all cards that are scheduled for today
Find all cards that are scheduled for today
def dynToday(self, search, order=False):
    """Find all cards that are scheduled for today"""
    tokens = search.split()
    dids = [int(i) for i in self.col.decks.allIds()]
    idids = []
    sdids = []
    for t in tokens:
        # set decks according to search phrase
        if t.startswith("-deck:"):
            l = idids
        elif t.startswith("deck:"):
            l = sdids
        else:
            continue
        name = ":".join(t.split(":")[1:]).replace('"', '').replace("'", "")
        deck = self.col.decks.byName(name)
        if not deck:
            continue
        did = deck["id"]
        if did not in l:
            l += [did] + [a[1] for a in self.col.decks.children(did)]
    if sdids:
        dids = sdids
    if idids:
        dids = [did for did in dids if did not in idids]
    ids = []
    for did in dids:
        newlim = self._deckNewLimit(did)
        revlim = self._deckRevLimit(did)
        # new cards according to deck limits
        ids += self.col.db.list("""
            select id from cards where did = ? and
                queue = 0 order by due limit ?""", did, newlim)
        # due cards according to deck limits
        ids += self.col.db.list("""
            select id from cards where did = %s and
                (queue in (2,3) and due <= %d) or
                (queue = 1 and due <= %d) 
                order by due limit %d""" % (did, self.today, self.dayCutoff, revlim))
    # randomize if option set
    if order == 1:
        random.shuffle(ids)
    return ids
def dynToday ( self , search , order = False ) : tokens = search . split ( ) dids = [ int ( i ) for i in self . col . decks . allIds ( ) ] idids = [ ] sdids = [ ] for t in tokens : # set decks according to search phrase if t . startswith ( "-deck:" ) : l = idids elif t . startswith ( "deck:" ) : l = sdids else : continue name = ":" . join ( t . split ( ":" ) [ 1 : ] ) . replace ( '"' , '' ) . replace ( "'" , "" ) deck = self . col . decks . byName ( name ) if not deck : continue did = deck [ "id" ] if did not in l : l += [ did ] + [ a [ 1 ] for a in self . col . decks . children ( did ) ] if sdids : dids = sdids if idids : dids = [ did for did in dids if did not in idids ] ids = [ ] for did in dids : newlim = self . _deckNewLimit ( did ) revlim = self . _deckRevLimit ( did ) # new cards according to deck limits ids += self . col . db . list ( """
            select id from cards where did = ? and
                queue = 0 order by due limit ?""" , did , newlim ) # due cards according to deck limits ids += self . col . db . list ( """
            select id from cards where did = %s and
                (queue in (2,3) and due <= %d) or
                (queue = 1 and due <= %d) 
                order by due limit %d""" % ( did , self . today , self . dayCutoff , revlim ) ) # randomize if option set if order == 1 : random . shuffle ( ids ) return ids