lune-stone / anki-addon-limit-new-by-young

An add-on for Anki that can aid in maintaining a stable and efficient daily workload.
GNU Affero General Public License v3.0
7 stars 4 forks source link

cards due soon #12

Closed aleksejrs closed 8 months ago

aleksejrs commented 8 months ago

Because both youngCardLimit and loadLimit only use intervals and not actual due cards, the add-on would not notice a huge load caused by mature cards, as Cardistry would. The amount of (prop:due<21 prop:ivl>21) grows, so youngCardLimit needs to be decreased. Load also grows a little, and is less intuitive.

The proposed cards due soon limit is a little more intuitive than Load, but it ignores intervals and everything else.

These three blocks are simple edits of Young Card Limit, but I think the number of days should be customizable. I couldn't make it less than a week because of Easy Days and temporary backlogs.

def soon(deckName: str) -> int:
    '''Takes in a number deck name prefix, returns the number of young cards excluding suspended'''
    return len(list(mw.col.find_cards(f'deck:"{deckName}" -is:new prop:due<7 -is:suspended')))
        soonLimit = addonConfigLimits.get('soonLimit', 999999999)
        soonCount = 0 if soonLimit > deck_size else soon(deckIndentifer.name)
    lines.append('=== Soon Limit ===')
    lines.append('')
    rows = []
    for did, deckName in sorted(deckNames.items(), key=lambda x: x[1]):
        soonCount = soon(deckName)
        rule = {} if not mapping[did] else limits[mapping[did][0]]
        soonLimit = rule.get('soonLimit', float('inf'))

        rows.append(f"{100.0 * (soonCount / max(soonLimit, sys.float_info.epsilon)):.2f}% ({soonCount} of {soonLimit})\t{deckName}")
    rows.sort(key=lambda x: -1 * float(x.split('%')[0]))
    lines.extend(rows)

    lines.append('')
    lines.append('')