mirror of
https://github.com/ankitects/anki.git
synced 2025-09-18 14:02:21 -04:00
don't hide learning count on congrats screen when learning is overdue
The v3 scheduler will delay the final card from being shown twice in a row, but the overdue case was being treated the same as the no-learning case, leading to the message being hidden.
This commit is contained in:
parent
3cec1a35dc
commit
070f57fcc5
2 changed files with 10 additions and 7 deletions
|
@ -21,10 +21,13 @@ impl Collection {
|
|||
let info = self.storage.congrats_info(&deck, today)?;
|
||||
let is_filtered_deck = deck.is_filtered();
|
||||
let deck_description = deck.rendered_description();
|
||||
let secs_until_next_learn = ((info.next_learn_due as i64)
|
||||
- self.learn_ahead_secs() as i64
|
||||
- TimestampSecs::now().0)
|
||||
.max(0) as u32;
|
||||
let secs_until_next_learn = if info.next_learn_due == 0 {
|
||||
// signal to the frontend that no learning cards are due later
|
||||
86_400
|
||||
} else {
|
||||
((info.next_learn_due as i64) - self.learn_ahead_secs() as i64 - TimestampSecs::now().0)
|
||||
.max(60) as u32
|
||||
};
|
||||
Ok(pb::CongratsInfoResponse {
|
||||
learn_remaining: info.learn_count,
|
||||
review_remaining: info.review_remaining,
|
||||
|
@ -56,7 +59,7 @@ mod test {
|
|||
have_sched_buried: false,
|
||||
have_user_buried: false,
|
||||
is_filtered_deck: false,
|
||||
secs_until_next_learn: 0,
|
||||
secs_until_next_learn: 86_400,
|
||||
bridge_commands_supported: true,
|
||||
deck_description: "".to_string()
|
||||
}
|
||||
|
|
|
@ -15,8 +15,8 @@ export async function getCongratsInfo(): Promise<Scheduler.CongratsInfoResponse>
|
|||
|
||||
export function buildNextLearnMsg(info: Scheduler.CongratsInfoResponse): string {
|
||||
const secsUntil = info.secsUntilNextLearn;
|
||||
// next learning card not due (/ until tomorrow)?
|
||||
if (secsUntil == 0 || secsUntil > 86_400) {
|
||||
// next learning card not due today?
|
||||
if (secsUntil >= 86_400) {
|
||||
return "";
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue