diff --git a/AnkiDroid/src/main/java/com/ichi2/libanki/sched/SchedV2.java b/AnkiDroid/src/main/java/com/ichi2/libanki/sched/SchedV2.java index 512c2dff4c9e..2595c965e51d 100644 --- a/AnkiDroid/src/main/java/com/ichi2/libanki/sched/SchedV2.java +++ b/AnkiDroid/src/main/java/com/ichi2/libanki/sched/SchedV2.java @@ -597,19 +597,15 @@ protected int _walkingCount(@NonNull LimitMethod limFn, @NonNull CountMethod cnt @RustCleanup("enable for v2 once backend is updated to 2.1.41+") @RustCleanup("once both v1 and v2 are using backend, cancelListener can be removed") public List> deckDueTree(@Nullable CancelListener cancelListener) { - if (AnkiDroidApp.TESTING_USE_V16_BACKEND && this instanceof Sched) { - // The 2.1.34 backend code can't be used for V2 at the moment, because - // the deck list count handling changed in 2.1.41, and test_review_limits - // expects the newer behaviour (which was already ported to AnkiDroid). - // So we only use the backend to calculate V1 at the moment. + if (AnkiDroidApp.TESTING_USE_V16_BACKEND) { return mCol.getBackend().legacyDeckDueTree(true); + } else { + List allDecksSorted = deckDueList(cancelListener); + if (allDecksSorted == null) { + return null; + } + return _groupChildren(allDecksSorted, true); } - - List allDecksSorted = deckDueList(cancelListener); - if (allDecksSorted == null) { - return null; - } - return _groupChildren(allDecksSorted, true); } /** diff --git a/AnkiDroid/src/test/java/com/ichi2/libanki/sched/SchedV2Test.java b/AnkiDroid/src/test/java/com/ichi2/libanki/sched/SchedV2Test.java index 78a28462e8df..36dc731c2448 100644 --- a/AnkiDroid/src/test/java/com/ichi2/libanki/sched/SchedV2Test.java +++ b/AnkiDroid/src/test/java/com/ichi2/libanki/sched/SchedV2Test.java @@ -820,8 +820,12 @@ public void test_review_limits() throws Exception { c.flush(); } - // position 0 is default deck. Different from upstream - TreeNode tree = col.getSched().deckDueTree().get(1); + int parentIndex = 0; + if (!AnkiDroidApp.TESTING_USE_V16_BACKEND) { + // position 0 is default deck. Different from upstream + parentIndex = 1; + } + TreeNode tree = col.getSched().deckDueTree().get(parentIndex); // (('parent', 1514457677462, 5, 0, 0, (('child', 1514457677463, 5, 0, 0, ()),))) assertEquals("parent", tree.getValue().getFullDeckName()); assertEquals(5, tree.getValue().getRevCount()); // paren, tree.review_count)t @@ -837,7 +841,7 @@ public void test_review_limits() throws Exception { col.getSched().answerCard(c, BUTTON_THREE); assertEquals(new Counts(0, 0, 9), col.getSched().counts()); - tree = col.getSched().deckDueTree().get(1); + tree = col.getSched().deckDueTree().get(parentIndex); assertEquals(4, tree.getValue().getRevCount()); assertEquals(9, tree.getChildren().get(0).getValue().getRevCount()); }