A wildcard deck name pulls in forgotten cards from unrelated decks

オープン
#784 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

メンテナーはふだん 1 日以内に返信

まだ誰も着手していません。

評価

難易度
3/5
見積もり時間
1〜2日
初心者へのやさしさ
30/100
issue の種類
バグ
明瞭さ
おおむね明確
活発さ
活発
技術スタック
kotlin
領域
mobile

調査の方向性

Start with the two proposed tests in AnkiDroid/src/test/java/com/ichi2/anki/dialogs/CustomStudyDialogTest.kt, which exercise the STUDY_FORGOT custom study flow. The first checks that forgotten cards from a deck named _* stay in Default; the second checks that the positive button is enabled after unsuspending a forgotten card. The issue says it should be split into separate issues, so confirm the scope with maintainers first. Done means both bugs are reproduced by tests and the tests pass.

索引モデルが issue の本文から書いたものです。

説明

upstream-issue

Assisted-by: GPT-6.2-Sol xhigh & GPT-6.2-Astra xhigh

Subject: [EXISTING] A wildcard deck name pulls in forgotten cards from unrelated decks

Reviewing forgotten cards in a deck named `_*` can move cards from unrelated decks into the Custom Study Session.

⚠️ This issue existed before the PR and should likely be split off into a separate issue.

---
diff --git a/AnkiDroid/src/test/java/com/ichi2/anki/dialogs/CustomStudyDialogTest.kt b/AnkiDroid/src/test/java/com/ichi2/anki/dialogs/CustomStudyDialogTest.kt
index d7f3bc9c7c..cc7367c5ce 100644
--- a/AnkiDroid/src/test/java/com/ichi2/anki/dialogs/CustomStudyDialogTest.kt
+++ b/AnkiDroid/src/test/java/com/ichi2/anki/dialogs/CustomStudyDialogTest.kt
@@ -165,6 +165,23 @@ class CustomStudyDialogTest : RobolectricTest() {
             }
         }
 
+    @Test
+    fun `forgotten cards stay within a deck named underscore asterisk`() =
+        runTest {
+            TimeManager.reset()
+            val forgottenCard = addBasicNote().firstCard()
+            col.sched.answerCard(forgottenCard, CardAnswer.Rating.AGAIN)
+            val sourceDeck = addDeck("_*")
+            col.setDeck(listOf(addBasicNote("Unreviewed", "Card").firstCard().id), sourceDeck)
+
+            withCustomStudyFragment(args = argumentsDisplayingSubscreen(ContextMenuOption.STUDY_FORGOT, deckId = sourceDeck)) { fragment ->
+                val dialog = fragment.requireDialog() as AlertDialog
+                if (dialog.positiveButton.isEnabled) fragment.submitSubscreenData()
+            }
+
+            assertEquals(Consts.DEFAULT_DECK_ID, col.getCard(forgottenCard.id).did, "Custom Study must keep cards from Default in Default")
+        }
+
     @Test
     fun `cancelling a defaults read prevents late deck selection`() =
         runTest {
Confirmation stays disabled after a forgotten card becomes eligible [P2]
Subject: Confirmation stays disabled after a forgotten card becomes eligible

Unsuspending the only forgotten card leaves confirmation disabled until the day range is edited.

---
diff --git a/AnkiDroid/src/test/java/com/ichi2/anki/dialogs/CustomStudyDialogTest.kt b/AnkiDroid/src/test/java/com/ichi2/anki/dialogs/CustomStudyDialogTest.kt
index cc7367c5ce..e4a1db3821 100644
--- a/AnkiDroid/src/test/java/com/ichi2/anki/dialogs/CustomStudyDialogTest.kt
+++ b/AnkiDroid/src/test/java/com/ichi2/anki/dialogs/CustomStudyDialogTest.kt
@@ -58,6 +58,7 @@ import com.ichi2.anki.libanki.DeckId
 import com.ichi2.anki.libanki.Note
 import com.ichi2.anki.libanki.QueueType
 import com.ichi2.anki.libanki.sched.Scheduler
+import com.ichi2.anki.observability.undoableOp
 import com.ichi2.anki.utils.ext.DIALOG_FRAGMENT_TAG
 import com.ichi2.anki.utils.ext.showDialogFragment
 import com.ichi2.testutils.AnkiFragmentScenario
@@ -182,6 +183,27 @@ class CustomStudyDialogTest : RobolectricTest() {
             assertEquals(Consts.DEFAULT_DECK_ID, col.getCard(forgottenCard.id).did, "Custom Study must keep cards from Default in Default")
         }
 
+    @Test
+    fun `forgotten cards become available when unsuspended with the dialog open`() =
+        runTest {
+            TimeManager.reset()
+            val card = addBasicNote().firstCard()
+            col.sched.answerCard(card, CardAnswer.Rating.AGAIN)
+            col.sched.suspendCards(listOf(card.id))
+
+            createHostActivity().use { controller ->
+                val fragment = CustomStudyDialog.createSubDialog(Consts.DEFAULT_DECK_ID, ContextMenuOption.STUDY_FORGOT)
+                controller.get().showDialogFragment(fragment)
+                shadowOf(Looper.getMainLooper()).idle()
+
+                undoableOp { sched.unsuspendCards(listOf(card.id)) }
+                shadowOf(Looper.getMainLooper()).idle()
+
+                val dialog = fragment.requireDialog() as AlertDialog
+                assertTrue(dialog.positiveButton.isEnabled, "Restoring a forgotten card makes the same day range eligible")
+            }
+        }
+
     @Test
     fun `cancelling a defaults read prevents late deck selection`() =
         runTest {

Originally posted by @david-allison in https://github.com/ankidroid/Anki-Android/pull/23360#pullrequestreview-6007634151

主要言語
Kotlin
スター
93
フォーク
60
平均マージ
18時間 14分
マージ済み PR(30日)
9

環境構築

このプロジェクトには開発コンテナ、Dockerfile、コントリビューションガイドがありません。まず README を読み、一般的な手順ははじめてのコントリビューションガイドを参照してください。

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

ankidroid/Anki-Android-Backend のほかの issue

ankidroid/Anki-Android-Backend の issue をすべて見る

似ている issue

Kotlin の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。