Kanji-Dojo icon indicating copy to clipboard operation
Kanji-Dojo copied to clipboard

reschedule repeat kanjis later

Open martinetd opened this issue 4 months ago • 4 comments

Flagging a kanji as bad currently always reschedules it in position 2 (after 2 other kanjis)

This feels way too soon for me; I'm currently experimenting rescheduling it at random between 7 and 15 kanjis later:

diff --git a/core/src/commonMain/kotlin/ua/syt0r/kanji/presentation/screen/main/screen/practice_common/CharacterReviewManager.kt b/core/src/commonMain/kotlin/ua/syt0r/kanji/presentation/screen/main/screen/practice_common/CharacterReviewManager.kt
index d07a93690fc5..796095697e5f 100644
--- a/core/src/commonMain/kotlin/ua/syt0r/kanji/presentation/screen/main/screen/practice_common/CharacterReviewManager.kt
+++ b/core/src/commonMain/kotlin/ua/syt0r/kanji/presentation/screen/main/screen/practice_common/CharacterReviewManager.kt
@@ -8,6 +8,7 @@ import kotlinx.datetime.Instant
 import ua.syt0r.kanji.core.time.TimeUtils
 import java.util.LinkedList
 import kotlin.math.min
+import kotlin.random.Random
 import kotlin.time.Duration
 
 interface CharacterReviewManager<HistoryStatus, CharacterDetails, CharacterReviewSummary> {
@@ -57,10 +58,6 @@ abstract class BaseCharacterReviewManager<HistoryStatus, CharacterDetails, Chara
     private val onCompletedCallback: () -> Unit
 ) : CharacterReviewManager<HistoryStatus, CharacterDetails, CharacterReviewSummary> {
 
-    companion object {
-        private const val RepeatIndexShift = 2
-    }
-
     private val queue = LinkedList(reviewItems)
     private val completedItems =
         mutableListOf<Pair<String, SummaryCharacterData<CharacterReviewSummary>>>()
@@ -130,7 +127,8 @@ abstract class BaseCharacterReviewManager<HistoryStatus, CharacterDetails, Chara
         val updatedCharacterData = queue.poll().run {
             copy(history = history.plus(status))
         }
-        val insertPosition = min(RepeatIndexShift, queue.size)
+        val randomPos = Random.nextInt(7, 15)
+        val insertPosition = min(randomPos, queue.size)
         queue.add(insertPosition, updatedCharacterData)
 
         addCharacterReviewDuration(updatedCharacterData.character)

However I suppose you had a reason to make it only 2? Perhaps this should be made into an option? That's probably not too much work to make it an option so I'll be happy to scratch this itch myself if you're ok with it as a first contrib :)

EDIT: ah, likewise learn new mode probably shouldn't reschedule it back to back, but in that case something like +2 sounds appropriate. I'm not using learn new much as I'm still reviewing kanjis I ought to know at this point, so not as much a problem for me here -- I assume that button maps to StudyNext in code I didn't check...

martinetd avatar Mar 02 '24 12:03 martinetd