Satisfy formatter

This commit is contained in:
Henrik Giesel 2021-01-18 23:27:57 +01:00
parent 4a733de94e
commit a5947e5c65
3 changed files with 17 additions and 11 deletions

View file

@ -230,7 +230,6 @@ impl Collection {
self.set_config(ConfigKey::NewReviewMix, &(mix as u8)) self.set_config(ConfigKey::NewReviewMix, &(mix as u8))
} }
pub(crate) fn get_first_weekday(&self) -> Weekday { pub(crate) fn get_first_weekday(&self) -> Weekday {
match self.get_config_default::<u8, _>(ConfigKey::FirstWeekday) { match self.get_config_default::<u8, _>(ConfigKey::FirstWeekday) {
1 => Weekday::Monday, 1 => Weekday::Monday,

View file

@ -25,7 +25,6 @@ impl Collection {
let offset = self.local_utc_offset_for_user()?; let offset = self.local_utc_offset_for_user()?;
let local_offset_secs = offset.local_minus_utc() as i64; let local_offset_secs = offset.local_minus_utc() as i64;
let cards = self.storage.all_searched_cards()?; let cards = self.storage.all_searched_cards()?;
let revlog = if all { let revlog = if all {
self.storage.get_all_revlog_entries(revlog_start)? self.storage.get_all_revlog_entries(revlog_start)?

View file

@ -13,14 +13,21 @@ import { select, mouse } from "d3-selection";
import { scaleLinear, scaleSequential } from "d3-scale"; import { scaleLinear, scaleSequential } from "d3-scale";
import { showTooltip, hideTooltip } from "./tooltip"; import { showTooltip, hideTooltip } from "./tooltip";
import { GraphBounds, setDataAvailable, RevlogRange } from "./graph-helpers"; import { GraphBounds, setDataAvailable, RevlogRange } from "./graph-helpers";
import { timeDay, timeYear, timeSunday, timeMonday, timeFriday, timeSaturday } from "d3-time"; import {
timeDay,
timeYear,
timeSunday,
timeMonday,
timeFriday,
timeSaturday,
} from "d3-time";
import type { CountableTimeInterval } from "d3-time"; import type { CountableTimeInterval } from "d3-time";
import type { I18n } from "anki/i18n"; import type { I18n } from "anki/i18n";
export interface GraphData { export interface GraphData {
// indexed by day, where day is relative to today // indexed by day, where day is relative to today
reviewCount: Map<number, number>; reviewCount: Map<number, number>;
timeFunction: CountableTimeInterval, timeFunction: CountableTimeInterval;
} }
interface DayDatum { interface DayDatum {
@ -47,13 +54,14 @@ export function gatherData(data: pb.BackendProto.GraphsOut): GraphData {
reviewCount.set(day, count + 1); reviewCount.set(day, count + 1);
} }
let timeFunction = data.firstWeekday === 1 const timeFunction =
? timeMonday data.firstWeekday === 1
: data.firstWeekday === 5 ? timeMonday
? timeFriday : data.firstWeekday === 5
: data.firstWeekday === 6 ? timeFriday
? timeSaturday : data.firstWeekday === 6
: timeSunday; ? timeSaturday
: timeSunday;
return { reviewCount, timeFunction }; return { reviewCount, timeFunction };
} }