Make cardCountsSeparateInactive settable
This commit is contained in:
parent
806e52d6db
commit
834f2de99b
@ -48,6 +48,7 @@ pub(crate) enum ConfigKey {
|
||||
ShowIntervalsAboveAnswerButtons,
|
||||
NewReviewMix,
|
||||
FirstDayOfWeek,
|
||||
CardCountsSeparateInactive,
|
||||
AnswerTimeLimitSecs,
|
||||
ShowDayLearningCardsFirst,
|
||||
LastUnburiedDay,
|
||||
@ -77,6 +78,7 @@ impl From<ConfigKey> for &'static str {
|
||||
ConfigKey::ShowIntervalsAboveAnswerButtons => "estTimes",
|
||||
ConfigKey::NewReviewMix => "newSpread",
|
||||
ConfigKey::FirstDayOfWeek => "firstDayOfWeek",
|
||||
ConfigKey::CardCountsSeparateInactive => "cardCountsSeparateInactive",
|
||||
ConfigKey::AnswerTimeLimitSecs => "timeLim",
|
||||
ConfigKey::ShowDayLearningCardsFirst => "dayLearnFirst",
|
||||
ConfigKey::LastUnburiedDay => "lastUnburied",
|
||||
@ -238,6 +240,15 @@ impl Collection {
|
||||
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 {
|
||||
self.get_config_optional(ConfigKey::ShowRemainingDueCountsInStudy)
|
||||
.unwrap_or(true)
|
||||
|
@ -1,7 +1,9 @@
|
||||
// Copyright: Ankitects Pty Ltd and contributors
|
||||
// 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 {
|
||||
pub(crate) fn graph_data_for_search(
|
||||
@ -48,7 +50,7 @@ impl Collection {
|
||||
pub(crate) fn graphs_preferences(&self) -> Result<pb::GraphsPreferencesOut> {
|
||||
Ok(pb::GraphsPreferencesOut {
|
||||
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,
|
||||
_ => Weekday::Sunday,
|
||||
})?;
|
||||
self.set_card_counts_separate_inactive(prefs.card_counts_separate_inactive)?;
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
|
@ -52,8 +52,8 @@
|
||||
i18n,
|
||||
nightMode,
|
||||
revlogRange,
|
||||
calendarFirstDayOfWeek.set,
|
||||
)
|
||||
calendarFirstDayOfWeek.set
|
||||
);
|
||||
}
|
||||
|
||||
const title = i18n.tr(i18n.TR.STATISTICS_CALENDAR_TITLE);
|
||||
|
@ -86,7 +86,7 @@ export function renderCalendar(
|
||||
i18n: I18n,
|
||||
nightMode: boolean,
|
||||
revlogRange: RevlogRange,
|
||||
setFirstDayOfWeek: (d: number) => void,
|
||||
setFirstDayOfWeek: (d: number) => void
|
||||
): void {
|
||||
const svg = select(svgElem);
|
||||
const now = new Date();
|
||||
@ -184,7 +184,11 @@ export function renderCalendar(
|
||||
.attr("font-family", "monospace")
|
||||
.style("user-select", "none")
|
||||
.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);
|
||||
|
||||
svg.select("g.days")
|
||||
@ -203,5 +207,5 @@ export function renderCalendar(
|
||||
.on("mouseout", hideTooltip)
|
||||
.transition()
|
||||
.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 New Issue
Block a user