mirror of
https://github.com/ankitects/anki.git
synced 2025-09-19 14:32:22 -04:00

* avoid repinning Rust deps by default
* add id_tree dependency
* Respect intermediate child limits in v3
* Test new behaviour of v3 counts
* Rework v3 queue building to respect parent limits
* Add missing did field to SQL query
* Fix `LimitTreeMap::is_exhausted()`
* Rework tree building logic
https://github.com/ankitects/anki/pull/1638#discussion_r798328734
* Add timer for build_queues()
* `is_exhausted()` -> `limit_reached()`
* Move context and limits into `QueueBuilder`
This allows for moving more logic into QueueBuilder, so less passing
around of arguments. Unfortunately, some tests will require additional
work to set up.
* Fix stop condition in new_cards_by_position
* Fix order gather order of new cards by deck
* Add scheduler/queue/builder/burying.rs
* Fix bad tree due to unsorted child decks
* Fix comment
* Fix `cap_new_to_review_rec()`
* Add test for new card gathering
* Always sort `child_decks()`
* Fix deck removal in `cap_new_to_review_rec()`
* Fix sibling ordering in new card gathering
* Remove limits for deck total count with children
* Add random gather order
* Remove bad sibling order handling
All routines ensure ascending order now.
Also do some other minor refactoring.
* Remove queue truncating
All routines stop now as soon as the root limit is reached.
* Move deck fetching into `QueueBuilder::new()`
* Rework new card gather and sort options
https://github.com/ankitects/anki/pull/1638#issuecomment-1032173013
* Disable new sort order choices ...
depending on set gather order.
* Use enum instead of numbers
* Ensure valid sort order setting
* Update new gather and sort order tooltips
* Warn about random insertion order with v3
* Revert "Add timer for build_queues()"
This reverts commit c9f5fc6ebe
.
* Update rslib/src/storage/card/mod.rs (dae)
* minor wording tweaks to the tooltips (dae)
+ move legacy strings to bottom
+ consistent capitalization (our leech action still needs fixing,
but that will require introducing a new 'suspend card' string as the
existing one is used elsewhere as well)
148 lines
5.7 KiB
Svelte
148 lines
5.7 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 DynamicallySlottable from "../components/DynamicallySlottable.svelte";
|
|
import Item from "../components/Item.svelte";
|
|
import * as tr from "../lib/ftl";
|
|
import { DeckConfig } from "../lib/proto";
|
|
import EnumSelectorRow from "./EnumSelectorRow.svelte";
|
|
import type { DeckOptionsState } from "./lib";
|
|
import { reviewMixChoices } from "./strings";
|
|
import TitledContainer from "./TitledContainer.svelte";
|
|
|
|
export let state: DeckOptionsState;
|
|
export let api: Record<string, never>;
|
|
|
|
const config = state.currentConfig;
|
|
const defaults = state.defaults;
|
|
|
|
const currentDeck = "\n\n" + tr.deckConfigDisplayOrderWillUseCurrentDeck();
|
|
|
|
const newGatherPriorityChoices = [
|
|
tr.deckConfigNewGatherPriorityDeck(),
|
|
tr.deckConfigNewGatherPriorityPositionLowestFirst(),
|
|
tr.deckConfigNewGatherPriorityPositionHighestFirst(),
|
|
tr.deckConfigNewGatherPriorityRandomNotes(),
|
|
tr.deckConfigNewGatherPriorityRandomCards(),
|
|
];
|
|
const newSortOrderChoices = [
|
|
tr.deckConfigSortOrderTemplateThenGather(),
|
|
tr.deckConfigSortOrderGather(),
|
|
tr.deckConfigSortOrderCardTemplateThenRandom(),
|
|
tr.deckConfigSortOrderRandomNoteThenTemplate(),
|
|
tr.deckConfigSortOrderRandom(),
|
|
];
|
|
const reviewOrderChoices = [
|
|
tr.deckConfigSortOrderDueDateThenRandom(),
|
|
tr.deckConfigSortOrderDueDateThenDeck(),
|
|
tr.deckConfigSortOrderDeckThenDueDate(),
|
|
tr.deckConfigSortOrderAscendingIntervals(),
|
|
tr.deckConfigSortOrderDescendingIntervals(),
|
|
tr.deckConfigSortOrderAscendingEase(),
|
|
tr.deckConfigSortOrderDescendingEase(),
|
|
];
|
|
|
|
const GatherOrder = DeckConfig.DeckConfig.Config.NewCardGatherPriority;
|
|
const SortOrder = DeckConfig.DeckConfig.Config.NewCardSortOrder;
|
|
let disabledNewSortOrders: number[] = [];
|
|
$: {
|
|
switch ($config.newCardGatherPriority) {
|
|
case GatherOrder.NEW_CARD_GATHER_PRIORITY_RANDOM_NOTES:
|
|
disabledNewSortOrders = [
|
|
// same as NEW_CARD_SORT_ORDER_TEMPLATE
|
|
SortOrder.NEW_CARD_SORT_ORDER_TEMPLATE_THEN_RANDOM,
|
|
// same as NEW_CARD_SORT_ORDER_NO_SORT
|
|
SortOrder.NEW_CARD_SORT_ORDER_RANDOM_NOTE_THEN_TEMPLATE,
|
|
];
|
|
break;
|
|
case GatherOrder.NEW_CARD_GATHER_PRIORITY_RANDOM_CARDS:
|
|
disabledNewSortOrders = [
|
|
// same as NEW_CARD_SORT_ORDER_TEMPLATE
|
|
SortOrder.NEW_CARD_SORT_ORDER_TEMPLATE_THEN_RANDOM,
|
|
// not useful if siblings are not gathered together
|
|
SortOrder.NEW_CARD_SORT_ORDER_RANDOM_NOTE_THEN_TEMPLATE,
|
|
// same as NEW_CARD_SORT_ORDER_NO_SORT
|
|
SortOrder.NEW_CARD_SORT_ORDER_RANDOM_CARD,
|
|
];
|
|
break;
|
|
default:
|
|
disabledNewSortOrders = [];
|
|
break;
|
|
}
|
|
|
|
// disabled options aren't deselected automatically
|
|
if (disabledNewSortOrders.includes($config.newCardSortOrder)) {
|
|
// default option should never be disabled
|
|
$config.newCardSortOrder = 0;
|
|
}
|
|
|
|
// check for invalid index from previous version
|
|
if (!($config.newCardSortOrder in SortOrder)) {
|
|
$config.newCardSortOrder = 0;
|
|
}
|
|
}
|
|
</script>
|
|
|
|
<TitledContainer title={tr.deckConfigOrderingTitle()}>
|
|
<DynamicallySlottable slotHost={Item} {api}>
|
|
<Item>
|
|
<EnumSelectorRow
|
|
bind:value={$config.newCardGatherPriority}
|
|
defaultValue={defaults.newCardGatherPriority}
|
|
choices={newGatherPriorityChoices}
|
|
markdownTooltip={tr.deckConfigNewGatherPriorityTooltip_2() +
|
|
currentDeck}
|
|
>
|
|
{tr.deckConfigNewGatherPriority()}
|
|
</EnumSelectorRow>
|
|
</Item>
|
|
|
|
<Item>
|
|
<EnumSelectorRow
|
|
bind:value={$config.newCardSortOrder}
|
|
defaultValue={defaults.newCardSortOrder}
|
|
choices={newSortOrderChoices}
|
|
disabled={disabledNewSortOrders}
|
|
markdownTooltip={tr.deckConfigNewCardSortOrderTooltip_2() + currentDeck}
|
|
>
|
|
{tr.deckConfigNewCardSortOrder()}
|
|
</EnumSelectorRow>
|
|
</Item>
|
|
|
|
<Item>
|
|
<EnumSelectorRow
|
|
bind:value={$config.newMix}
|
|
defaultValue={defaults.newMix}
|
|
choices={reviewMixChoices()}
|
|
markdownTooltip={tr.deckConfigNewReviewPriorityTooltip() + currentDeck}
|
|
>
|
|
{tr.deckConfigNewReviewPriority()}
|
|
</EnumSelectorRow>
|
|
</Item>
|
|
|
|
<Item>
|
|
<EnumSelectorRow
|
|
bind:value={$config.interdayLearningMix}
|
|
defaultValue={defaults.interdayLearningMix}
|
|
choices={reviewMixChoices()}
|
|
markdownTooltip={tr.deckConfigInterdayStepPriorityTooltip() +
|
|
currentDeck}
|
|
>
|
|
{tr.deckConfigInterdayStepPriority()}
|
|
</EnumSelectorRow>
|
|
</Item>
|
|
|
|
<Item>
|
|
<EnumSelectorRow
|
|
bind:value={$config.reviewOrder}
|
|
defaultValue={defaults.reviewOrder}
|
|
choices={reviewOrderChoices}
|
|
markdownTooltip={tr.deckConfigReviewSortOrderTooltip() + currentDeck}
|
|
>
|
|
{tr.deckConfigReviewSortOrder()}
|
|
</EnumSelectorRow>
|
|
</Item>
|
|
</DynamicallySlottable>
|
|
</TitledContainer>
|