From 2606a8a489060deb3faeee91759c70b4165fc03e Mon Sep 17 00:00:00 2001 From: cecini Date: Tue, 27 Oct 2020 11:21:02 +0800 Subject: [PATCH 1/2] align rslib get_subnode impl with anki pythonapi find_deck_in_tree, fix nestdeck due counts issue --- CONTRIBUTORS | 1 + rslib/src/decks/tree.rs | 7 +++++-- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/CONTRIBUTORS b/CONTRIBUTORS index c85c3ae31..c0c1c2088 100644 --- a/CONTRIBUTORS +++ b/CONTRIBUTORS @@ -66,6 +66,7 @@ David Allison Tsung-Han Yu Piotr Kubowicz RumovZ +Cecini ******************** diff --git a/rslib/src/decks/tree.rs b/rslib/src/decks/tree.rs index d42015180..b60d7b794 100644 --- a/rslib/src/decks/tree.rs +++ b/rslib/src/decks/tree.rs @@ -175,9 +175,12 @@ fn hide_default_deck(node: &mut DeckTreeNode) { } fn get_subnode(top: DeckTreeNode, target: DeckID) -> Option { + 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); } } From 1a6476cf4ea29ecc1652dcce76a3275854a25abc Mon Sep 17 00:00:00 2001 From: cecini <66195864+cecini@users.noreply.github.com> Date: Thu, 29 Oct 2020 23:55:59 +0800 Subject: [PATCH 2/2] Update CONTRIBUTORS --- CONTRIBUTORS | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CONTRIBUTORS b/CONTRIBUTORS index c0c1c2088..ce1c41866 100644 --- a/CONTRIBUTORS +++ b/CONTRIBUTORS @@ -66,7 +66,7 @@ David Allison Tsung-Han Yu Piotr Kubowicz RumovZ -Cecini +Cecini ********************