(self, g)
return lim
Limit for deck without parent limits,
    modified to only show cards every n days
Limit for deck without parent limits,
    modified to only show cards every n days
Limit for deck without parent limits modified to only show cards every n days
def myDeckNewLimitSingle(self, g):
    """Limit for deck without parent limits,
    modified to only show cards every n days"""
    debug(f"Calling myDeckNewLimitSingle({g})")
    if g['dyn']:
        return self.reportLimit
    did = g['id']
    c = self.col.decks.confForDid(did)
    cname = c['name']
    deck = self.col.decks.nameOrNone(did)
    per_day = c['new']['perDay']
    lim = max(0, per_day - g['newToday'][1])
    if cname in option_limits:
        our_limit = option_limits[cname]
    elif per_day <= 1 and deck in deck_limits and deck_limits[deck] != 1:
        our_limit = deck_limits[deck]
    else:
        return lim
    dsel = "cid in (select id from cards where did = %s)" % did
    last = self.col.db.scalar(
        "select id from revlog where type = 0 and ivl > 0 and %s order by id desc limit 1" % dsel)
    if not last:
        return lim
    last_new = last/1000
    last_cutoff = self.dayCutoff - 86400
    # days between last graduation and yesterday's cutoff:
    ddays = -(-(last_cutoff - last_new) // 86400.0) # ceil
    if ddays < our_limit:
        lim = 0
    # print ddays
    return lim
def myDeckNewLimitSingle ( self , g ) : debug ( f"Calling myDeckNewLimitSingle({g})" ) if g [ 'dyn' ] : return self . reportLimit did = g [ 'id' ] c = self . col . decks . confForDid ( did ) cname = c [ 'name' ] deck = self . col . decks . nameOrNone ( did ) per_day = c [ 'new' ] [ 'perDay' ] lim = max ( 0 , per_day - g [ 'newToday' ] [ 1 ] ) if cname in option_limits : our_limit = option_limits [ cname ] elif per_day <= 1 and deck in deck_limits and deck_limits [ deck ] != 1 : our_limit = deck_limits [ deck ] else : return lim dsel = "cid in (select id from cards where did = %s)" % did last = self . col . db . scalar ( "select id from revlog where type = 0 and ivl > 0 and %s order by id desc limit 1" % dsel ) if not last : return lim last_new = last / 1000 last_cutoff = self . dayCutoff - 86400 # days between last graduation and yesterday's cutoff: ddays = - ( - ( last_cutoff - last_new ) // 86400.0 ) # ceil if ddays < our_limit : lim = 0 # print ddays return lim