mirror of
https://github.com/ankitects/anki.git
synced 2025-12-12 22:36:55 -05:00
when merging day# in deck, make sure to reset older values
This commit is contained in:
parent
5590b22683
commit
78a6813b9b
1 changed files with 18 additions and 9 deletions
|
|
@ -258,18 +258,27 @@ impl From<&DeckCommonSchema11> for DeckCommon {
|
||||||
} else {
|
} else {
|
||||||
serde_json::to_vec(&common.other).unwrap_or_default()
|
serde_json::to_vec(&common.other).unwrap_or_default()
|
||||||
};
|
};
|
||||||
|
// since we're combining the day values into a single value,
|
||||||
|
// any items from an earlier day need to be reset
|
||||||
|
let mut today = common.today.clone();
|
||||||
|
// time is always updated, so will always be the latest
|
||||||
|
let max_day = today.time.day;
|
||||||
|
if today.lrn.day != max_day {
|
||||||
|
today.lrn.amount = 0;
|
||||||
|
}
|
||||||
|
if today.rev.day != max_day {
|
||||||
|
today.rev.amount = 0;
|
||||||
|
}
|
||||||
|
if today.new.day != max_day {
|
||||||
|
today.new.amount = 0;
|
||||||
|
}
|
||||||
DeckCommon {
|
DeckCommon {
|
||||||
study_collapsed: common.study_collapsed,
|
study_collapsed: common.study_collapsed,
|
||||||
browser_collapsed: common.browser_collapsed,
|
browser_collapsed: common.browser_collapsed,
|
||||||
last_day_studied: common
|
last_day_studied: max_day as u32,
|
||||||
.today
|
new_studied: today.new.amount,
|
||||||
.new
|
review_studied: today.rev.amount,
|
||||||
.day
|
learning_studied: today.lrn.amount,
|
||||||
.max(common.today.lrn.day)
|
|
||||||
.max(common.today.rev.day) as u32,
|
|
||||||
new_studied: common.today.new.amount,
|
|
||||||
review_studied: common.today.rev.amount,
|
|
||||||
learning_studied: common.today.lrn.amount,
|
|
||||||
secs_studied: common.today.time.amount,
|
secs_studied: common.today.time.amount,
|
||||||
other,
|
other,
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue