mirror of
https://github.com/ankitects/anki.git
synced 2025-09-21 07:22:23 -04:00

* Feat/support load balance and easy days in FSRS simulator * format * consider LoadBalancerEnabled * use fsrs::PostSchedulingFn * add load balance and easy days to compute_optimal_retention * move simulator to a pop-over * fix incorrect simulationNumber when error 500 * Feat: Save to Preset Options * update tabs when update newPerDay & reviewsPerDay * don't reset deckSize & daysToSimulate when save options * fix missing easy days * plan to support review priority * Fix graph line rendering with non-scaling stroke * simplify review priority function with helper wrapper * fallback to default ReviewPriority for Added & ReverseAdded * Update ts/routes/deck-options/SimulatorModal.svelte Co-authored-by: Luc Mcgrady <lucmcgrady@gmail.com> * Wrap review priority function in Arc for thread-safe sharing * more granularity for R sorting * Add graph smoothing option to FSRS simulator * Improve graph resize handling in FSRS simulator * simplify review priority calculation * Add review order selection to FSRS simulator modal * Refactor review priority function using macro for conciseness * Add copyright and license header to SimulatorModal.svelte * cargo clippy * ./ninja fix:eslint * update fsrs-rs * Update FSRS dependencies and refactor load balancing functions - Update fsrs-rs dependency to latest commit - Modify retention and simulator modules to use Arc instead of Box - Update function signatures and imports in simulator module - Simplify review card order handling with direct enum usage * resolve reviewed changes * replace .unwrap() with ? * move simulating into SimulatorModal * add (crate) to interval_to_weekday * Update FsrsOptions.svelte * format --------- Co-authored-by: Luc Mcgrady <lucmcgrady@gmail.com>
103 lines
3.4 KiB
Svelte
103 lines
3.4 KiB
Svelte
<!--
|
|
Copyright: Ankitects Pty Ltd and contributors
|
|
License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
|
|
-->
|
|
<script lang="ts">
|
|
import * as tr from "@generated/ftl";
|
|
import { HelpPage } from "@tslib/help-page";
|
|
import type Carousel from "bootstrap/js/dist/carousel";
|
|
import type Modal from "bootstrap/js/dist/modal";
|
|
|
|
import DynamicallySlottable from "$lib/components/DynamicallySlottable.svelte";
|
|
import HelpModal from "$lib/components/HelpModal.svelte";
|
|
import Item from "$lib/components/Item.svelte";
|
|
import SettingTitle from "$lib/components/SettingTitle.svelte";
|
|
import SwitchRow from "$lib/components/SwitchRow.svelte";
|
|
import TitledContainer from "$lib/components/TitledContainer.svelte";
|
|
import { type HelpItem, HelpItemScheduler } from "$lib/components/types";
|
|
|
|
import FsrsOptions from "./FsrsOptions.svelte";
|
|
import GlobalLabel from "./GlobalLabel.svelte";
|
|
import type { DeckOptionsState } from "./lib";
|
|
|
|
export let state: DeckOptionsState;
|
|
export let api: Record<string, never>;
|
|
export let onPresetChange: () => void;
|
|
|
|
const fsrs = state.fsrs;
|
|
|
|
const settings = {
|
|
fsrs: {
|
|
title: "FSRS",
|
|
help: tr.deckConfigFsrsTooltip(),
|
|
url: HelpPage.DeckOptions.fsrs,
|
|
},
|
|
desiredRetention: {
|
|
title: tr.deckConfigDesiredRetention(),
|
|
help: tr.deckConfigDesiredRetentionTooltip(),
|
|
sched: HelpItemScheduler.FSRS,
|
|
},
|
|
modelParams: {
|
|
title: tr.deckConfigWeights(),
|
|
help:
|
|
tr.deckConfigWeightsTooltip2() +
|
|
"\n\n" +
|
|
tr.deckConfigComputeOptimalWeightsTooltip2(),
|
|
sched: HelpItemScheduler.FSRS,
|
|
},
|
|
rescheduleCardsOnChange: {
|
|
title: tr.deckConfigRescheduleCardsOnChange(),
|
|
help: tr.deckConfigRescheduleCardsOnChangeTooltip(),
|
|
sched: HelpItemScheduler.FSRS,
|
|
},
|
|
computeOptimalRetention: {
|
|
title: tr.deckConfigComputeOptimalRetention(),
|
|
help: tr.deckConfigComputeOptimalRetentionTooltip4(),
|
|
sched: HelpItemScheduler.FSRS,
|
|
},
|
|
};
|
|
const helpSections: HelpItem[] = Object.values(settings);
|
|
|
|
let modal: Modal;
|
|
let carousel: Carousel;
|
|
|
|
function openHelpModal(index: number): void {
|
|
modal.show();
|
|
carousel.to(index);
|
|
}
|
|
</script>
|
|
|
|
<TitledContainer title={"FSRS"}>
|
|
<HelpModal
|
|
title={"FSRS"}
|
|
url={HelpPage.DeckOptions.fsrs}
|
|
slot="tooltip"
|
|
fsrs={$fsrs}
|
|
{helpSections}
|
|
on:mount={(e) => {
|
|
modal = e.detail.modal;
|
|
carousel = e.detail.carousel;
|
|
}}
|
|
/>
|
|
<DynamicallySlottable slotHost={Item} {api}>
|
|
<Item>
|
|
<SwitchRow bind:value={$fsrs} defaultValue={false}>
|
|
<SettingTitle
|
|
on:click={() =>
|
|
openHelpModal(Object.keys(settings).indexOf("fsrs"))}
|
|
>
|
|
<GlobalLabel title={settings.fsrs.title} />
|
|
</SettingTitle>
|
|
</SwitchRow>
|
|
</Item>
|
|
|
|
{#if $fsrs}
|
|
<FsrsOptions
|
|
{state}
|
|
openHelpModal={(key) =>
|
|
openHelpModal(Object.keys(settings).indexOf(key))}
|
|
{onPresetChange}
|
|
/>
|
|
{/if}
|
|
</DynamicallySlottable>
|
|
</TitledContainer>
|