Skip to content

Commit

Permalink
Fixed the empty regular deck check, now uses foreach to check all the…
Browse files Browse the repository at this point in the history
… deck nodes in the tree to be empty
  • Loading branch information
devyk100 committed Feb 24, 2025
1 parent 7133b31 commit dd538c9
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions AnkiDroid/src/main/java/com/ichi2/anki/DeckPicker.kt
Original file line number Diff line number Diff line change
Expand Up @@ -2167,7 +2167,6 @@ open class DeckPicker :
openReviewerOrStudyOptions(selectionType)
return
}

when (queryCompletedDeckCustomStudyAction(did)) {
CompletedDeckStatus.LEARN_AHEAD_LIMIT_REACHED,
CompletedDeckStatus.REGULAR_DECK_NO_MORE_CARDS_TODAY,
Expand Down Expand Up @@ -2678,10 +2677,16 @@ open class DeckPicker :
withCol { sched.hasCardsTodayAfterStudyAheadLimit() } -> CompletedDeckStatus.LEARN_AHEAD_LIMIT_REACHED
withCol { sched.newDue() || sched.revDue() } -> CompletedDeckStatus.LEARN_AHEAD_LIMIT_REACHED
withCol { decks.isFiltered(did) } -> CompletedDeckStatus.DYNAMIC_DECK_NO_LIMITS_REACHED
getNodeByDid(did).children.isEmpty() &&
run {
val node = getNodeByDid(did)
withCol {
decks.isEmpty(did)
} -> CompletedDeckStatus.EMPTY_REGULAR_DECK
var allChildrenEmpty = true
node.forEach { deckNode ->
allChildrenEmpty = allChildrenEmpty && decks.isEmpty(deckNode.did)
}
allChildrenEmpty
}
} -> CompletedDeckStatus.EMPTY_REGULAR_DECK
else -> CompletedDeckStatus.REGULAR_DECK_NO_MORE_CARDS_TODAY
}

Expand Down

0 comments on commit dd538c9

Please sign in to comment.