mirror of
https://github.com/ankitects/anki.git
synced 2025-09-19 14:32:22 -04:00
(de)serialize Weekday directly
Re: discussion in https://github.com/ankitects/anki/pull/934
This commit is contained in:
parent
e2af5fb718
commit
99d732799c
1 changed files with 4 additions and 7 deletions
|
@ -18,7 +18,6 @@ pub(crate) fn schema11_config_as_string() -> String {
|
||||||
"curDeck": 1,
|
"curDeck": 1,
|
||||||
"newSpread": 0,
|
"newSpread": 0,
|
||||||
"collapseTime": 1200,
|
"collapseTime": 1200,
|
||||||
"firstWeekday": 0,
|
|
||||||
"timeLim": 0,
|
"timeLim": 0,
|
||||||
"estTimes": true,
|
"estTimes": true,
|
||||||
"dueCounts": true,
|
"dueCounts": true,
|
||||||
|
@ -231,12 +230,8 @@ impl Collection {
|
||||||
}
|
}
|
||||||
|
|
||||||
pub(crate) fn get_first_weekday(&self) -> Weekday {
|
pub(crate) fn get_first_weekday(&self) -> Weekday {
|
||||||
match self.get_config_default::<u8, _>(ConfigKey::FirstWeekday) {
|
self.get_config_optional(ConfigKey::FirstWeekday)
|
||||||
1 => Weekday::Monday,
|
.unwrap_or(Weekday::Sunday)
|
||||||
5 => Weekday::Friday,
|
|
||||||
6 => Weekday::Saturday,
|
|
||||||
_ => Weekday::Sunday,
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
pub(crate) fn get_show_due_counts(&self) -> bool {
|
pub(crate) fn get_show_due_counts(&self) -> bool {
|
||||||
|
@ -321,6 +316,8 @@ pub(crate) enum NewReviewMix {
|
||||||
NewFirst = 2,
|
NewFirst = 2,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[derive(PartialEq, Serialize_repr, Deserialize_repr, Clone, Copy)]
|
||||||
|
#[repr(u8)]
|
||||||
pub(crate) enum Weekday {
|
pub(crate) enum Weekday {
|
||||||
Sunday = 0,
|
Sunday = 0,
|
||||||
Monday = 1,
|
Monday = 1,
|
||||||
|
|
Loading…
Reference in a new issue