Merge pull request #805 from cecini/duecounts

align rslib get_subnode impl with anki pythonapi find_deck_in_tree
This commit is contained in:
Damien Elmes 2020-11-06 10:57:49 +10:00 committed by GitHub
commit 96f77b4b5e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 6 additions and 2 deletions

View file

@ -66,6 +66,7 @@ David Allison <davidallisongithub@gmail.com>
Tsung-Han Yu <johan456789@gmail.com>
Piotr Kubowicz <piotr.kubowicz@gmail.com>
RumovZ <gp5glkw78@relay.firefox.com>
Cecini <github.com/cecini>
********************

View file

@ -175,9 +175,12 @@ fn hide_default_deck(node: &mut DeckTreeNode) {
}
fn get_subnode(top: DeckTreeNode, target: DeckID) -> Option<DeckTreeNode> {
if top.deck_id == target.0 {
return Some(top);
}
for child in top.children {
if child.deck_id == target.0 {
return Some(child);
if let Some(node) = get_subnode(child, target) {
return Some(node);
}
}