mirror of
https://github.com/ankitects/anki.git
synced 2025-09-19 06:22:22 -04:00
Make cardCountsSeparateInactive settable
This commit is contained in:
parent
806e52d6db
commit
834f2de99b
4 changed files with 25 additions and 7 deletions
|
@ -48,6 +48,7 @@ pub(crate) enum ConfigKey {
|
||||||
ShowIntervalsAboveAnswerButtons,
|
ShowIntervalsAboveAnswerButtons,
|
||||||
NewReviewMix,
|
NewReviewMix,
|
||||||
FirstDayOfWeek,
|
FirstDayOfWeek,
|
||||||
|
CardCountsSeparateInactive,
|
||||||
AnswerTimeLimitSecs,
|
AnswerTimeLimitSecs,
|
||||||
ShowDayLearningCardsFirst,
|
ShowDayLearningCardsFirst,
|
||||||
LastUnburiedDay,
|
LastUnburiedDay,
|
||||||
|
@ -77,6 +78,7 @@ impl From<ConfigKey> for &'static str {
|
||||||
ConfigKey::ShowIntervalsAboveAnswerButtons => "estTimes",
|
ConfigKey::ShowIntervalsAboveAnswerButtons => "estTimes",
|
||||||
ConfigKey::NewReviewMix => "newSpread",
|
ConfigKey::NewReviewMix => "newSpread",
|
||||||
ConfigKey::FirstDayOfWeek => "firstDayOfWeek",
|
ConfigKey::FirstDayOfWeek => "firstDayOfWeek",
|
||||||
|
ConfigKey::CardCountsSeparateInactive => "cardCountsSeparateInactive",
|
||||||
ConfigKey::AnswerTimeLimitSecs => "timeLim",
|
ConfigKey::AnswerTimeLimitSecs => "timeLim",
|
||||||
ConfigKey::ShowDayLearningCardsFirst => "dayLearnFirst",
|
ConfigKey::ShowDayLearningCardsFirst => "dayLearnFirst",
|
||||||
ConfigKey::LastUnburiedDay => "lastUnburied",
|
ConfigKey::LastUnburiedDay => "lastUnburied",
|
||||||
|
@ -238,6 +240,15 @@ impl Collection {
|
||||||
self.set_config(ConfigKey::FirstDayOfWeek, &weekday)
|
self.set_config(ConfigKey::FirstDayOfWeek, &weekday)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub(crate) fn get_card_counts_separate_inactive(&self) -> bool {
|
||||||
|
self.get_config_optional(ConfigKey::CardCountsSeparateInactive)
|
||||||
|
.unwrap_or(true)
|
||||||
|
}
|
||||||
|
|
||||||
|
pub(crate) fn set_card_counts_separate_inactive(&self, separate: bool) -> Result<()> {
|
||||||
|
self.set_config(ConfigKey::CardCountsSeparateInactive, &separate)
|
||||||
|
}
|
||||||
|
|
||||||
pub(crate) fn get_show_due_counts(&self) -> bool {
|
pub(crate) fn get_show_due_counts(&self) -> bool {
|
||||||
self.get_config_optional(ConfigKey::ShowRemainingDueCountsInStudy)
|
self.get_config_optional(ConfigKey::ShowRemainingDueCountsInStudy)
|
||||||
.unwrap_or(true)
|
.unwrap_or(true)
|
||||||
|
|
|
@ -1,7 +1,9 @@
|
||||||
// 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, prelude::*, revlog::RevlogEntry, search::SortMode, config::Weekday};
|
use crate::{
|
||||||
|
backend_proto as pb, config::Weekday, prelude::*, revlog::RevlogEntry, search::SortMode,
|
||||||
|
};
|
||||||
|
|
||||||
impl Collection {
|
impl Collection {
|
||||||
pub(crate) fn graph_data_for_search(
|
pub(crate) fn graph_data_for_search(
|
||||||
|
@ -48,7 +50,7 @@ impl Collection {
|
||||||
pub(crate) fn graphs_preferences(&self) -> Result<pb::GraphsPreferencesOut> {
|
pub(crate) fn graphs_preferences(&self) -> Result<pb::GraphsPreferencesOut> {
|
||||||
Ok(pb::GraphsPreferencesOut {
|
Ok(pb::GraphsPreferencesOut {
|
||||||
calendar_first_day_of_week: self.get_first_day_of_week() as i32,
|
calendar_first_day_of_week: self.get_first_day_of_week() as i32,
|
||||||
card_counts_separate_inactive: true,
|
card_counts_separate_inactive: self.get_card_counts_separate_inactive(),
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -59,6 +61,7 @@ impl Collection {
|
||||||
6 => Weekday::Saturday,
|
6 => Weekday::Saturday,
|
||||||
_ => Weekday::Sunday,
|
_ => Weekday::Sunday,
|
||||||
})?;
|
})?;
|
||||||
|
self.set_card_counts_separate_inactive(prefs.card_counts_separate_inactive)?;
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -52,8 +52,8 @@
|
||||||
i18n,
|
i18n,
|
||||||
nightMode,
|
nightMode,
|
||||||
revlogRange,
|
revlogRange,
|
||||||
calendarFirstDayOfWeek.set,
|
calendarFirstDayOfWeek.set
|
||||||
)
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
const title = i18n.tr(i18n.TR.STATISTICS_CALENDAR_TITLE);
|
const title = i18n.tr(i18n.TR.STATISTICS_CALENDAR_TITLE);
|
||||||
|
|
|
@ -86,7 +86,7 @@ export function renderCalendar(
|
||||||
i18n: I18n,
|
i18n: I18n,
|
||||||
nightMode: boolean,
|
nightMode: boolean,
|
||||||
revlogRange: RevlogRange,
|
revlogRange: RevlogRange,
|
||||||
setFirstDayOfWeek: (d: number) => void,
|
setFirstDayOfWeek: (d: number) => void
|
||||||
): void {
|
): void {
|
||||||
const svg = select(svgElem);
|
const svg = select(svgElem);
|
||||||
const now = new Date();
|
const now = new Date();
|
||||||
|
@ -184,7 +184,11 @@ export function renderCalendar(
|
||||||
.attr("font-family", "monospace")
|
.attr("font-family", "monospace")
|
||||||
.style("user-select", "none")
|
.style("user-select", "none")
|
||||||
.on("click", null)
|
.on("click", null)
|
||||||
.filter((d: number) => [Weekday.SUNDAY, Weekday.MONDAY, Weekday.FRIDAY, Weekday.SATURDAY].includes(d))
|
.filter((d: number) =>
|
||||||
|
[Weekday.SUNDAY, Weekday.MONDAY, Weekday.FRIDAY, Weekday.SATURDAY].includes(
|
||||||
|
d
|
||||||
|
)
|
||||||
|
)
|
||||||
.on("click", setFirstDayOfWeek);
|
.on("click", setFirstDayOfWeek);
|
||||||
|
|
||||||
svg.select("g.days")
|
svg.select("g.days")
|
||||||
|
@ -203,5 +207,5 @@ export function renderCalendar(
|
||||||
.on("mouseout", hideTooltip)
|
.on("mouseout", hideTooltip)
|
||||||
.transition()
|
.transition()
|
||||||
.duration(800)
|
.duration(800)
|
||||||
.attr("fill", (d) => d.count === 0 ? emptyColour : blues(d.count)!);
|
.attr("fill", (d) => (d.count === 0 ? emptyColour : blues(d.count)!));
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue