mirror of
https://github.com/ankitects/anki.git
synced 2025-09-18 14:02:21 -04:00
Merge pull request #805 from cecini/duecounts
align rslib get_subnode impl with anki pythonapi find_deck_in_tree
This commit is contained in:
commit
96f77b4b5e
2 changed files with 6 additions and 2 deletions
|
@ -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>
|
||||
|
||||
********************
|
||||
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue