Skip to content

Commit

Permalink
refactor(Card): replace setReps()
Browse files Browse the repository at this point in the history
  • Loading branch information
BrayanDSO committed Mar 24, 2024
1 parent f9b2933 commit f889fcd
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 10 deletions.
8 changes: 2 additions & 6 deletions AnkiDroid/src/main/java/com/ichi2/libanki/Card.kt
Original file line number Diff line number Diff line change
Expand Up @@ -84,8 +84,9 @@ open class Card : Cloneable {
var due: Int = 0
var ivl = 0
var factor = 0

@set:VisibleForTesting
var reps = 0
private set
var lapses = 0
var left = 0
var oDue: Int = 0
Expand Down Expand Up @@ -270,11 +271,6 @@ open class Card : Cloneable {
timerStarted = TimeManager.time.intTimeMS() - elapsedTime
}

@VisibleForTesting
fun setReps(reps: Int): Int {
return reps.also { this.reps = it }
}

@LibAnkiAlias("should_show_timer")
fun shouldShowTimer(col: Collection): Boolean {
val options = col.decks.configDictForDeckId(currentDeckId().did)
Expand Down
8 changes: 4 additions & 4 deletions AnkiDroid/src/test/java/com/ichi2/libanki/SchedulerTest.kt
Original file line number Diff line number Diff line change
Expand Up @@ -448,7 +448,7 @@ open class SchedulerTest : JvmTest() {
queue = QUEUE_TYPE_REV
due = (col.sched.today - 8)
factor = STARTING_FACTOR
setReps(3)
reps = 3
lapses = 1
ivl = 100
}
Expand Down Expand Up @@ -523,7 +523,7 @@ open class SchedulerTest : JvmTest() {
type = CARD_TYPE_REV
queue = QUEUE_TYPE_REV
due = col.sched.today
setReps(1)
reps = 1
ivl = 1
startTimer()
}
Expand Down Expand Up @@ -1266,7 +1266,7 @@ open class SchedulerTest : JvmTest() {
queue = QUEUE_TYPE_REV
due = 0
factor = STARTING_FACTOR
setReps(3)
reps = 3
lapses = 1
ivl = 100
startTimer()
Expand All @@ -1289,7 +1289,7 @@ open class SchedulerTest : JvmTest() {
ivl = 100
due = (col.sched.today - ivl)
factor = STARTING_FACTOR
setReps(3)
reps = 3
lapses = 1
startTimer()
}
Expand Down

0 comments on commit f889fcd

Please sign in to comment.