Fix new preview card's position being interpreted as a date (#1577)
* Fix new preview card's position being interpreted as a date Can be reproduced by opening the Card Info screen of a new preview card not answered yet. * Update rslib/src/stats/card.rs
This commit is contained in:
parent
349d5d0862
commit
aaaea03c72
@ -1,7 +1,12 @@
|
|||||||
// Copyright: Ankitects Pty Ltd and contributors
|
// Copyright: Ankitects Pty Ltd and contributors
|
||||||
// License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
|
// License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
|
||||||
|
|
||||||
use crate::{backend_proto as pb, card::CardQueue, prelude::*, revlog::RevlogEntry};
|
use crate::{
|
||||||
|
backend_proto as pb,
|
||||||
|
card::{CardQueue, CardType},
|
||||||
|
prelude::*,
|
||||||
|
revlog::RevlogEntry,
|
||||||
|
};
|
||||||
|
|
||||||
impl Collection {
|
impl Collection {
|
||||||
pub fn card_stats(&mut self, cid: CardId) -> Result<pb::CardStatsResponse> {
|
pub fn card_stats(&mut self, cid: CardId) -> Result<pb::CardStatsResponse> {
|
||||||
@ -66,10 +71,15 @@ impl Collection {
|
|||||||
),
|
),
|
||||||
CardQueue::Review | CardQueue::DayLearn => (
|
CardQueue::Review | CardQueue::DayLearn => (
|
||||||
{
|
{
|
||||||
let days_remaining = due - (self.timing_today()?.days_elapsed as i32);
|
if card.ctype == CardType::New {
|
||||||
let mut due = TimestampSecs::now();
|
// new preview card not answered yet
|
||||||
due.0 += (days_remaining as i64) * 86_400;
|
None
|
||||||
Some(pb::generic::Int64 { val: due.0 })
|
} else {
|
||||||
|
let days_remaining = due - (self.timing_today()?.days_elapsed as i32);
|
||||||
|
let mut due = TimestampSecs::now();
|
||||||
|
due.0 += (days_remaining as i64) * 86_400;
|
||||||
|
Some(pb::generic::Int64 { val: due.0 })
|
||||||
|
}
|
||||||
},
|
},
|
||||||
None,
|
None,
|
||||||
),
|
),
|
||||||
|
Loading…
Reference in New Issue
Block a user