mirror of
https://github.com/ankitects/anki.git
synced 2026-01-12 21:44:01 -05:00
per day values
This commit is contained in:
parent
1c0a9c8bed
commit
307ab52c1c
2 changed files with 16 additions and 8 deletions
|
|
@ -17,6 +17,7 @@ License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
|
||||||
SimulateSubgraph,
|
SimulateSubgraph,
|
||||||
SimulateWorkloadSubgraph,
|
SimulateWorkloadSubgraph,
|
||||||
type Point,
|
type Point,
|
||||||
|
type WorkloadPoint,
|
||||||
} from "../graphs/simulator";
|
} from "../graphs/simulator";
|
||||||
import * as tr from "@generated/ftl";
|
import * as tr from "@generated/ftl";
|
||||||
import { renderSimulationChart, renderWorkloadChart } from "../graphs/simulator";
|
import { renderSimulationChart, renderWorkloadChart } from "../graphs/simulator";
|
||||||
|
|
@ -65,7 +66,7 @@ License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
|
||||||
|
|
||||||
let svg: HTMLElement | SVGElement | null = null;
|
let svg: HTMLElement | SVGElement | null = null;
|
||||||
let simulationNumber = 0;
|
let simulationNumber = 0;
|
||||||
let points: Point[] = [];
|
let points: (WorkloadPoint | Point)[] = [];
|
||||||
const newCardsIgnoreReviewLimit = state.newCardsIgnoreReviewLimit;
|
const newCardsIgnoreReviewLimit = state.newCardsIgnoreReviewLimit;
|
||||||
let smooth = true;
|
let smooth = true;
|
||||||
let suspendLeeches = $config.leechAction == DeckConfig_Config_LeechAction.SUSPEND;
|
let suspendLeeches = $config.leechAction == DeckConfig_Config_LeechAction.SUSPEND;
|
||||||
|
|
@ -215,13 +216,14 @@ License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
|
||||||
memorized: v,
|
memorized: v,
|
||||||
count: resp!.reviewCount[dr],
|
count: resp!.reviewCount[dr],
|
||||||
label: simulationNumber,
|
label: simulationNumber,
|
||||||
|
learnSpan: simulateFsrsRequest.daysToSimulate,
|
||||||
})),
|
})),
|
||||||
);
|
);
|
||||||
|
|
||||||
tableData = renderWorkloadChart(
|
tableData = renderWorkloadChart(
|
||||||
svg as SVGElement,
|
svg as SVGElement,
|
||||||
bounds,
|
bounds,
|
||||||
points,
|
points as WorkloadPoint[],
|
||||||
simulateWorkloadSubgraph,
|
simulateWorkloadSubgraph,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
@ -300,7 +302,8 @@ License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
|
||||||
tableData = render_function(
|
tableData = render_function(
|
||||||
svg as SVGElement,
|
svg as SVGElement,
|
||||||
bounds,
|
bounds,
|
||||||
pointsToRender,
|
// This cast shouldn't matter because we aren't switching between modes in the same modal
|
||||||
|
pointsToRender as WorkloadPoint[],
|
||||||
(workload ? simulateWorkloadSubgraph : simulateSubgraph) as any as never,
|
(workload ? simulateWorkloadSubgraph : simulateSubgraph) as any as never,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -31,6 +31,10 @@ export interface Point {
|
||||||
label: number;
|
label: number;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export type WorkloadPoint = Point & {
|
||||||
|
learnSpan: number;
|
||||||
|
};
|
||||||
|
|
||||||
export enum SimulateSubgraph {
|
export enum SimulateSubgraph {
|
||||||
time,
|
time,
|
||||||
count,
|
count,
|
||||||
|
|
@ -47,7 +51,7 @@ export enum SimulateWorkloadSubgraph {
|
||||||
export function renderWorkloadChart(
|
export function renderWorkloadChart(
|
||||||
svgElem: SVGElement,
|
svgElem: SVGElement,
|
||||||
bounds: GraphBounds,
|
bounds: GraphBounds,
|
||||||
data: Point[],
|
data: WorkloadPoint[],
|
||||||
subgraph: SimulateWorkloadSubgraph,
|
subgraph: SimulateWorkloadSubgraph,
|
||||||
) {
|
) {
|
||||||
const xMin = 70;
|
const xMin = 70;
|
||||||
|
|
@ -59,8 +63,8 @@ export function renderWorkloadChart(
|
||||||
|
|
||||||
const subgraph_data = ({
|
const subgraph_data = ({
|
||||||
[SimulateWorkloadSubgraph.ratio]: data.map(d => ({ ...d, y: d.timeCost / d.memorized })),
|
[SimulateWorkloadSubgraph.ratio]: data.map(d => ({ ...d, y: d.timeCost / d.memorized })),
|
||||||
[SimulateWorkloadSubgraph.time]: data.map(d => ({ ...d, y: d.timeCost })),
|
[SimulateWorkloadSubgraph.time]: data.map(d => ({ ...d, y: d.timeCost / d.learnSpan })),
|
||||||
[SimulateWorkloadSubgraph.count]: data.map(d => ({ ...d, y: d.count })),
|
[SimulateWorkloadSubgraph.count]: data.map(d => ({ ...d, y: d.count / d.learnSpan })),
|
||||||
[SimulateWorkloadSubgraph.memorized]: data.map(d => ({ ...d, y: d.memorized })),
|
[SimulateWorkloadSubgraph.memorized]: data.map(d => ({ ...d, y: d.memorized })),
|
||||||
})[subgraph];
|
})[subgraph];
|
||||||
|
|
||||||
|
|
@ -73,8 +77,9 @@ export function renderWorkloadChart(
|
||||||
const formatY: (value: number) => string = ({
|
const formatY: (value: number) => string = ({
|
||||||
[SimulateWorkloadSubgraph.ratio]: (value: number) =>
|
[SimulateWorkloadSubgraph.ratio]: (value: number) =>
|
||||||
tr.deckConfigFsrsSimulatorRatioTooltip({ time: timeSpan(value) }),
|
tr.deckConfigFsrsSimulatorRatioTooltip({ time: timeSpan(value) }),
|
||||||
[SimulateWorkloadSubgraph.time]: timeSpan,
|
[SimulateWorkloadSubgraph.time]: (value: number) =>
|
||||||
[SimulateWorkloadSubgraph.count]: (value: number) => tr.statisticsReviews({ reviews: Math.round(value) }),
|
tr.statisticsMinutesPerDay({ count: parseFloat((value / 60).toPrecision(2)) }),
|
||||||
|
[SimulateWorkloadSubgraph.count]: (value: number) => tr.statisticsReviewsPerDay({ count: Math.round(value) }),
|
||||||
[SimulateWorkloadSubgraph.memorized]: (value: number) =>
|
[SimulateWorkloadSubgraph.memorized]: (value: number) =>
|
||||||
tr.statisticsMemorized({ memorized: Math.round(value).toFixed(0) }),
|
tr.statisticsMemorized({ memorized: Math.round(value).toFixed(0) }),
|
||||||
})[subgraph];
|
})[subgraph];
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue