From dbbcb3e38ce56f740a81e17057ff1797a012e9c9 Mon Sep 17 00:00:00 2001 From: Damien Elmes Date: Thu, 13 May 2021 15:23:16 +1000 Subject: [PATCH] expose new sorting options in test scheduler options; move things around --- ftl/core/deck-config.ftl | 59 +++++++++++++++---- pylib/anki/collection.py | 2 +- qt/aqt/main.py | 2 +- qt/aqt/preferences.py | 13 ++-- rslib/backend.proto | 3 +- rslib/src/deckconfig/update.rs | 1 + rslib/src/preferences.rs | 8 ++- ts/deckoptions/BUILD.bazel | 1 + ts/deckoptions/BuryingOptions.svelte | 27 --------- ts/deckoptions/ConfigEditor.svelte | 8 +-- ts/deckoptions/LearningOptions.svelte | 40 +++++++++++++ ts/deckoptions/NewOptions.svelte | 55 ++++++++++++----- ...pseOptions.svelte => ReviewOptions.svelte} | 28 ++++++--- ts/deckoptions/lib.ts | 2 + ts/deckoptions/strings.ts | 10 ++++ 15 files changed, 184 insertions(+), 75 deletions(-) delete mode 100644 ts/deckoptions/BuryingOptions.svelte create mode 100644 ts/deckoptions/LearningOptions.svelte rename ts/deckoptions/{LapseOptions.svelte => ReviewOptions.svelte} (58%) create mode 100644 ts/deckoptions/strings.ts diff --git a/ftl/core/deck-config.ftl b/ftl/core/deck-config.ftl index 11570d9fc..e7b01eb3c 100644 --- a/ftl/core/deck-config.ftl +++ b/ftl/core/deck-config.ftl @@ -21,8 +21,9 @@ deck-config-review-limit-tooltip = The maximum number of review cards to show in a day, if cards are ready for review. -## New Cards section +## Learning/Relearning section +deck-config-learning-relearning-title = Learning/Relearning deck-config-learning-steps = Learning steps # Please don't translate '5m' or '2d' -deck-config-delay-hint = Delays can be in minutes (eg "5m"), or days (eg "2d"). @@ -32,21 +33,56 @@ deck-config-learning-steps-tooltip = The Good button will advance to the next step, which is 10 minutes by default. Once all steps have been passed, the card will become a review card, and will appear on a different day. { -deck-config-delay-hint } -deck-config-graduating-interval-tooltip = - The number of days to wait before showing a card again, after the Good button - is pressed on the final learning step. -deck-config-easy-interval-tooltip = - The number of days to wait before showing a card again, after the Easy button - is used to immediately remove a card from learning. - -## Lapses section - deck-config-relearning-steps = Relearning steps deck-config-relearning-steps-tooltip = Zero or more delays, separated by spaces. By default, pressing the Again button on a review card will show it again 10 minutes later. If no delays are provided, the card will have its interval changed, without entering relearning. { -deck-config-delay-hint } +deck-config-interday-step-priority = Interday step priority +deck-config-interday-step-priority-tooltip = When to show (re)learning cards that cross a day boundary. +deck-config-review-mix-mix-with-reviews = Mix with reviews +deck-config-review-mix-show-after-reviews = Show after reviews +deck-config-review-mix-show-before-reviews = Show before reviews + +## New Cards section + +deck-config-graduating-interval-tooltip = + The number of days to wait before showing a card again, after the Good button + is pressed on the final learning step. +deck-config-easy-interval-tooltip = + The number of days to wait before showing a card again, after the Easy button + is used to immediately remove a card from learning. +deck-config-new-insertion-order = Insertion order +deck-config-new-insertion-order-tooltip = + Controls the position (due #) new cards are assigned when you add new cards. + Cards with a lower due # will be shown first when reviewing. Changing this + option will automatically update the existing position of new cards. +deck-config-new-insertion-order-sequential = Sequential (show oldest cards first) +deck-config-new-insertion-order-random = Random +deck-config-sort-order = Sort order +deck-config-sort-order-tooltip = + After today's new cards have been gathered, this option controls the order + they are then presented in. The default is to sort by card template first, to avoid + multiple cards of the same note from being shown in succession. +deck-config-sort-order-card-template-then-position = Card template, then position +deck-config-sort-order-card-template-then-random = Card template, then random +deck-config-sort-order-position = Position (siblings together) +deck-config-sort-order-random = Random +deck-config-new-priority = Priority +deck-config-new-priority-tooltip = When to show new cards in a study session. + +## Review section + +deck-config-review-sort-order-tooltip = + After today's review cards have been gathered, this option controls the order + they are then presented in. The default is to sort by due date, then shuffle, so + that if you have a backlog of reviews, the cards that have been waiting longest + will be shown first. The other choices can be useful when you have a large backlog + and want to tackle it in a different way. +deck-config-sort-order-due-date-then-random = Due date, then random +deck-config-sort-order-ascending-intervals = Ascending intervals +deck-config-sort-order-descending-intervals = Descending intervals deck-config-leech-threshold-tooltip = The number of times Again needs to be pressed on a review card before it is marked as a leech. Leeches are cards that consume a lot of your time, and @@ -60,7 +96,8 @@ deck-config-leech-action-tooltip = ## Burying section -deck-config-burying-title = Burying +deck-config-bury-new-siblings = Bury new siblings until the next day +deck-config-bury-review-siblings = Bury review siblings until the next day deck-config-bury-tooltip = Whether other cards of the same note (eg reverse cards, adjacent cloze deletions) will be delayed until the next day. diff --git a/pylib/anki/collection.py b/pylib/anki/collection.py index 7257fc2da..f403aa904 100644 --- a/pylib/anki/collection.py +++ b/pylib/anki/collection.py @@ -142,7 +142,7 @@ class Collection: supportedSchedulerVersions = (1, 2) - def schedVer(self) -> Any: + def schedVer(self) -> Literal[1, 2]: ver = self.conf.get("schedVer", 1) if ver in self.supportedSchedulerVersions: return ver diff --git a/qt/aqt/main.py b/qt/aqt/main.py index a73841127..4cacdd471 100644 --- a/qt/aqt/main.py +++ b/qt/aqt/main.py @@ -1134,7 +1134,7 @@ title="%s" %s>%s""" % ( if deck["dyn"]: aqt.dialogs.open("FilteredDeckConfigDialog", self, deck_id=deck["id"]) else: - if KeyboardModifiersPressed().shift: + if KeyboardModifiersPressed().shift or self.col.schedVer() == 1: aqt.deckconf.DeckConf(self, deck) else: DeckOptionsDialog(self) diff --git a/qt/aqt/preferences.py b/qt/aqt/preferences.py index 758f769d2..896ba13d3 100644 --- a/qt/aqt/preferences.py +++ b/qt/aqt/preferences.py @@ -55,16 +55,19 @@ class Preferences(QDialog): form = self.form scheduling = self.prefs.scheduling + + version = scheduling.scheduler_version + form.dayLearnFirst.setVisible(version == 2) + # fixme: force on for v3 + form.legacy_timezone.setVisible(version >= 2) + form.newSpread.setVisible(version < 3) + form.lrnCutoff.setValue(int(scheduling.learn_ahead_secs / 60.0)) form.newSpread.addItems(list(newCardSchedulingLabels(self.mw.col).values())) form.newSpread.setCurrentIndex(scheduling.new_review_mix) form.dayLearnFirst.setChecked(scheduling.day_learn_first) form.dayOffset.setValue(scheduling.rollover) - if scheduling.scheduler_version < 2: - form.dayLearnFirst.setVisible(False) - form.legacy_timezone.setVisible(False) - else: - form.legacy_timezone.setChecked(not scheduling.new_timezone) + form.legacy_timezone.setChecked(not scheduling.new_timezone) reviewing = self.prefs.reviewing form.timeLimit.setValue(int(reviewing.time_limit_secs / 60.0)) diff --git a/rslib/backend.proto b/rslib/backend.proto index 755fa6aa8..2175d086d 100644 --- a/rslib/backend.proto +++ b/rslib/backend.proto @@ -925,6 +925,7 @@ message DeckConfigsForUpdate { CurrentDeck current_deck = 2; DeckConfig defaults = 3; bool schema_modified = 4; + bool v3_scheduler = 5; } message UpdateDeckConfigsIn { @@ -1147,7 +1148,7 @@ message Preferences { NEW_FIRST = 2; } - // read only + // read only; 1-3 uint32 scheduler_version = 1; uint32 rollover = 2; diff --git a/rslib/src/deckconfig/update.rs b/rslib/src/deckconfig/update.rs index 6a94e1b31..e99ec7af9 100644 --- a/rslib/src/deckconfig/update.rs +++ b/rslib/src/deckconfig/update.rs @@ -37,6 +37,7 @@ impl Collection { .storage .get_collection_timestamps()? .schema_changed_since_sync(), + v3_scheduler: self.get_bool(BoolKey::Sched2021), }) } diff --git a/rslib/src/preferences.rs b/rslib/src/preferences.rs index fb7257f3b..3f037580b 100644 --- a/rslib/src/preferences.rs +++ b/rslib/src/preferences.rs @@ -45,7 +45,13 @@ impl Collection { Ok(Scheduling { scheduler_version: match self.scheduler_version() { crate::config::SchedulerVersion::V1 => 1, - crate::config::SchedulerVersion::V2 => 2, + crate::config::SchedulerVersion::V2 => { + if self.get_bool(BoolKey::Sched2021) { + 3 + } else { + 2 + } + } }, rollover: self.rollover_for_current_scheduler()? as u32, learn_ahead_secs: self.learn_ahead_secs(), diff --git a/ts/deckoptions/BUILD.bazel b/ts/deckoptions/BUILD.bazel index 060214fc5..5f0c8ddf8 100644 --- a/ts/deckoptions/BUILD.bazel +++ b/ts/deckoptions/BUILD.bazel @@ -57,6 +57,7 @@ ts_library( "icons.ts", "lib.ts", "steps.ts", + "strings.ts", "textInputModal.ts", ], module_name = "deckoptions", diff --git a/ts/deckoptions/BuryingOptions.svelte b/ts/deckoptions/BuryingOptions.svelte deleted file mode 100644 index 05543c8b4..000000000 --- a/ts/deckoptions/BuryingOptions.svelte +++ /dev/null @@ -1,27 +0,0 @@ - - - -

{tr.deckConfigBuryingTitle()}

- - - - diff --git a/ts/deckoptions/ConfigEditor.svelte b/ts/deckoptions/ConfigEditor.svelte index a8fe17a5e..3e41acb66 100644 --- a/ts/deckoptions/ConfigEditor.svelte +++ b/ts/deckoptions/ConfigEditor.svelte @@ -4,10 +4,10 @@ License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html --> + +

{tr.deckConfigLearningRelearningTitle()}

+ + ($config.learnSteps = evt.detail.value)} /> + + ($config.relearnSteps = evt.detail.value)} /> + +{#if state.v3Scheduler} + +{/if} diff --git a/ts/deckoptions/NewOptions.svelte b/ts/deckoptions/NewOptions.svelte index fee70efbe..24495c568 100644 --- a/ts/deckoptions/NewOptions.svelte +++ b/ts/deckoptions/NewOptions.svelte @@ -5,17 +5,24 @@ License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
-

{tr.schedulingLapses()}

+

{tr.schedulingReviews()}

- ($config.relearnSteps = evt.detail.value)} /> + + +
diff --git a/ts/deckoptions/lib.ts b/ts/deckoptions/lib.ts index c34cc38e7..416a4e9fd 100644 --- a/ts/deckoptions/lib.ts +++ b/ts/deckoptions/lib.ts @@ -57,6 +57,7 @@ export class DeckOptionsState { readonly currentDeck: pb.BackendProto.DeckConfigsForUpdate.CurrentDeck; readonly defaults: ConfigInner; readonly addonComponents: Writable; + readonly v3Scheduler: boolean; private targetDeckId: number; private configs: ConfigWithCount[]; @@ -82,6 +83,7 @@ export class DeckOptionsState { 0, this.configs.findIndex((c) => c.config.id === this.currentDeck.configId) ); + this.v3Scheduler = data.v3Scheduler; // decrement the use count of the starting item, as we'll apply +1 to currently // selected one at display time diff --git a/ts/deckoptions/strings.ts b/ts/deckoptions/strings.ts new file mode 100644 index 000000000..1c8962fcf --- /dev/null +++ b/ts/deckoptions/strings.ts @@ -0,0 +1,10 @@ +// Copyright: Ankitects Pty Ltd and contributors +// License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html + +import * as tr from "lib/i18n"; + +export const reviewMixChoices = (): string[] => [ + tr.deckConfigReviewMixMixWithReviews(), + tr.deckConfigReviewMixShowAfterReviews(), + tr.deckConfigReviewMixShowBeforeReviews(), +];