mirror of
https://github.com/ankitects/anki.git
synced 2025-09-20 06:52:21 -04:00
Fix RangeBox RevlogRange defaulting to All instead of Year
This commit is contained in:
parent
2a875ffc55
commit
19db519a7e
3 changed files with 8 additions and 6 deletions
|
@ -6,7 +6,7 @@
|
||||||
import type { I18n } from "anki/i18n";
|
import type { I18n } from "anki/i18n";
|
||||||
import type { PreferenceStore } from "./preferences";
|
import type { PreferenceStore } from "./preferences";
|
||||||
import type pb from "anki/backend_proto";
|
import type pb from "anki/backend_proto";
|
||||||
import { getGraphData, RevlogRange } from "./graph-helpers";
|
import { getGraphData, RevlogRange, daysToRevlogRange } from "./graph-helpers";
|
||||||
import { getPreferences } from "./preferences";
|
import { getPreferences } from "./preferences";
|
||||||
|
|
||||||
export let i18n: I18n;
|
export let i18n: I18n;
|
||||||
|
@ -31,7 +31,7 @@
|
||||||
getGraphData(search, days),
|
getGraphData(search, days),
|
||||||
preferencesPromise,
|
preferencesPromise,
|
||||||
]);
|
]);
|
||||||
revlogRange = days > 365 || days === 0 ? RevlogRange.All : RevlogRange.Year;
|
revlogRange = daysToRevlogRange(days);
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
sourceData = null;
|
sourceData = null;
|
||||||
alert(i18n.tr(i18n.TR.STATISTICS_ERROR_FETCHING));
|
alert(i18n.tr(i18n.TR.STATISTICS_ERROR_FETCHING));
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
import { createEventDispatcher } from "svelte";
|
import { createEventDispatcher } from "svelte";
|
||||||
|
|
||||||
import type { I18n } from "anki/i18n";
|
import type { I18n } from "anki/i18n";
|
||||||
import { RevlogRange } from "./graph-helpers";
|
import { RevlogRange, daysToRevlogRange } from "./graph-helpers";
|
||||||
|
|
||||||
enum SearchRange {
|
enum SearchRange {
|
||||||
Deck = 1,
|
Deck = 1,
|
||||||
|
@ -18,9 +18,7 @@
|
||||||
|
|
||||||
const dispatch = createEventDispatcher();
|
const dispatch = createEventDispatcher();
|
||||||
|
|
||||||
let revlogRange: RevlogRange =
|
let revlogRange = daysToRevlogRange(days);
|
||||||
days > 365 || days === 0 ? RevlogRange.Year : RevlogRange.All;
|
|
||||||
|
|
||||||
let searchRange: SearchRange =
|
let searchRange: SearchRange =
|
||||||
search === "deck:current"
|
search === "deck:current"
|
||||||
? SearchRange.Deck
|
? SearchRange.Deck
|
||||||
|
|
|
@ -41,6 +41,10 @@ export enum RevlogRange {
|
||||||
All = 2,
|
All = 2,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export function daysToRevlogRange(days: number): RevlogRange {
|
||||||
|
return days > 365 || days === 0 ? RevlogRange.All : RevlogRange.Year;
|
||||||
|
}
|
||||||
|
|
||||||
// period a graph should cover
|
// period a graph should cover
|
||||||
export enum GraphRange {
|
export enum GraphRange {
|
||||||
Month = 0,
|
Month = 0,
|
||||||
|
|
Loading…
Reference in a new issue