Show due date of buried/suspended cards in card info (#2820)
* Show due date of buried/suspended cards in card info * Simplify match and handle relearning cards * Omit ctype checks * Test due, not card.due (dae)
This commit is contained in:
parent
c5e2564523
commit
6cb4155e8e
@ -70,27 +70,28 @@ impl Collection {
|
|||||||
} else {
|
} else {
|
||||||
card.due
|
card.due
|
||||||
};
|
};
|
||||||
Ok(match card.queue {
|
Ok(match card.ctype {
|
||||||
CardQueue::New => (None, Some(due)),
|
CardType::New => {
|
||||||
CardQueue::Learn => (
|
if matches!(card.queue, CardQueue::Review | CardQueue::DayLearn) {
|
||||||
Some(TimestampSecs::now().0),
|
|
||||||
card.original_position.map(|u| u as i32),
|
|
||||||
),
|
|
||||||
CardQueue::Review | CardQueue::DayLearn => (
|
|
||||||
{
|
|
||||||
if card.ctype == CardType::New {
|
|
||||||
// new preview card not answered yet
|
// new preview card not answered yet
|
||||||
None
|
(None, card.original_position.map(|u| u as i32))
|
||||||
} else {
|
} else {
|
||||||
|
(None, Some(due))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
CardType::Review | CardType::Learn | CardType::Relearn => (
|
||||||
|
{
|
||||||
|
if due <= 1_000_000_000 {
|
||||||
let days_remaining = due - (self.timing_today()?.days_elapsed as i32);
|
let days_remaining = due - (self.timing_today()?.days_elapsed as i32);
|
||||||
let mut due = TimestampSecs::now();
|
let mut due = TimestampSecs::now();
|
||||||
due.0 += (days_remaining as i64) * 86_400;
|
due.0 += (days_remaining as i64) * 86_400;
|
||||||
Some(due.0)
|
Some(due.0)
|
||||||
|
} else {
|
||||||
|
Some(TimestampSecs::now().0)
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
card.original_position.map(|u| u as i32),
|
card.original_position.map(|u| u as i32),
|
||||||
),
|
),
|
||||||
_ => (None, None),
|
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user