Skip to content

Commit 01f0783

Browse files
authored
fix(reviewer): Check for timebox limit only after answering card
1 parent 8bfadcb commit 01f0783

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

AnkiDroid/src/main/java/com/ichi2/anki/Reviewer.kt

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1206,11 +1206,16 @@ open class Reviewer :
12061206
topCard.renderOutput(this@withCol, reload = true)
12071207
}
12081208
}
1209-
state?.timeboxReached?.let { dealWithTimeBox(it) }
1209+
12101210
currentCard = state?.topCard
12111211
queueState = state
12121212
}
12131213

1214+
/**
1215+
* Answer the current card, update the scheduler and checks if the timebox limit has been reached
1216+
* and, if so, displays a dialog to the user
1217+
* @param rating The user's rating for the card
1218+
*/
12141219
override suspend fun answerCardInner(rating: Rating) {
12151220
val state = queueState!!
12161221
val cardId = currentCard!!.id
@@ -1233,6 +1238,12 @@ open class Reviewer :
12331238
showSnackbar(leechMessage, Snackbar.LENGTH_SHORT)
12341239
}
12351240
}
1241+
1242+
// showing the timebox reached dialog if the timebox is reached
1243+
val timebox = withCol { timeboxReached() }
1244+
if (timebox != null) {
1245+
dealWithTimeBox(timebox)
1246+
}
12361247
}
12371248

12381249
private suspend fun dealWithTimeBox(timebox: Collection.TimeboxReached) {

0 commit comments

Comments
 (0)