(updateTotal: bool)
Update counts.

    After adding, editing or deleting cards (afterStateChange hook), updateTotal should be set to True to update
    totalCount[] based on doneCount[] and remainCount[]. No card should have been answered before this hook is
    triggered, so the change in remainCount[] should be caused by editing collection and therefore goes into
    totalCount[].

    When the user answer a card (showQuestion hook), updateTotal should be set to False to update doneCount[] based on
    totalCount[] and remainCount[]. No change to collection should have been made before this hook is
    triggered, so the change in remainCount[] should be caused by answering cards and therefore goes into
    doneCount[].

    In the later case, remainCount[] may still increase based on the weights of New, Lrn and Rev cards (see comments
    of "Calculation weights" above), in which case totalCount[] may still get updated based on forceForward setting.

    :param updateTotal: True for afterStateChange hook, False for showQuestion hook
Update counts.
Update counts .
def updateCountsForAllDecks(updateTotal: bool) -> None:
    """
    Update counts.

    After adding, editing or deleting cards (afterStateChange hook), updateTotal should be set to True to update
    totalCount[] based on doneCount[] and remainCount[]. No card should have been answered before this hook is
    triggered, so the change in remainCount[] should be caused by editing collection and therefore goes into
    totalCount[].

    When the user answer a card (showQuestion hook), updateTotal should be set to False to update doneCount[] based on
    totalCount[] and remainCount[]. No change to collection should have been made before this hook is
    triggered, so the change in remainCount[] should be caused by answering cards and therefore goes into
    doneCount[].

    In the later case, remainCount[] may still increase based on the weights of New, Lrn and Rev cards (see comments
    of "Calculation weights" above), in which case totalCount[] may still get updated based on forceForward setting.

    :param updateTotal: True for afterStateChange hook, False for showQuestion hook
    """

    if useOldAnkiAPI:
        for deckProp in mw.col.sched.deckDueList():
            did = deckProp[1]
            remain = calcProgress(deckProp[2], deckProp[3], deckProp[4])
            updateCountsForDeck(did, remain, updateTotal)
    else:
        for node in mw.col.sched.deck_due_tree().children:
            updateCountsForTree(node, updateTotal)
def updateCountsForAllDecks ( updateTotal : bool ) -> None : if useOldAnkiAPI : for deckProp in mw . col . sched . deckDueList ( ) : did = deckProp [ 1 ] remain = calcProgress ( deckProp [ 2 ] , deckProp [ 3 ] , deckProp [ 4 ] ) updateCountsForDeck ( did , remain , updateTotal ) else : for node in mw . col . sched . deck_due_tree ( ) . children : updateCountsForTree ( node , updateTotal )