mirror of
https://github.com/ankitects/anki.git
synced 2025-09-18 14:02:21 -04:00
Improve elapsed seconds calculation for learning cards in browser table (#4255)
* Improve calculation of elapsed seconds for learning cards in browser_table.rs https://github.com/ankitects/anki/pull/4231/files#r2257105522 * Format
This commit is contained in:
parent
82b9ba523a
commit
24243a7d55
1 changed files with 4 additions and 5 deletions
|
@ -132,15 +132,14 @@ impl Card {
|
|||
pub(crate) fn seconds_since_last_review(&self, timing: &SchedTimingToday) -> Option<u32> {
|
||||
if let Some(last_review_time) = self.last_review_time {
|
||||
Some(timing.now.elapsed_secs_since(last_review_time) as u32)
|
||||
} else if !self.is_due_in_days() {
|
||||
let last_review_time =
|
||||
TimestampSecs(self.original_or_current_due() as i64 - self.interval as i64);
|
||||
Some(timing.now.elapsed_secs_since(last_review_time) as u32)
|
||||
} else {
|
||||
} else if self.is_due_in_days() {
|
||||
self.due_time(timing).map(|due| {
|
||||
(due.adding_secs(-86_400 * self.interval as i64)
|
||||
.elapsed_secs()) as u32
|
||||
})
|
||||
} else {
|
||||
let last_review_time = TimestampSecs(self.original_or_current_due() as i64);
|
||||
Some(timing.now.elapsed_secs_since(last_review_time) as u32)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue