mirror of
https://github.com/ankitects/anki.git
synced 2025-09-18 22:12:21 -04:00
add options to v3 to preserve new card gather order
Allows cards to be presented in deck order when gather priority is set to 'deck'.
This commit is contained in:
parent
94a0355389
commit
131c8b72f8
4 changed files with 16 additions and 0 deletions
|
@ -113,6 +113,8 @@ deck-config-sort-order-card-template-then-random = Card template, then random
|
|||
deck-config-sort-order-lowest-position = Ascending position
|
||||
deck-config-sort-order-highest-position = Descending position
|
||||
deck-config-sort-order-random = Random
|
||||
deck-config-sort-order-template-then-gather = Card template, then order gathered
|
||||
deck-config-sort-order-gather = Order gathered
|
||||
deck-config-new-review-priority = New/review priority
|
||||
deck-config-new-review-priority-tooltip = When to show new cards in relation to review cards.
|
||||
deck-config-interday-step-priority = Interday learning/review priority
|
||||
|
|
|
@ -43,6 +43,10 @@ message DeckConfig {
|
|||
NEW_CARD_SORT_ORDER_LOWEST_POSITION = 3;
|
||||
NEW_CARD_SORT_ORDER_HIGHEST_POSITION = 4;
|
||||
NEW_CARD_SORT_ORDER_RANDOM = 5;
|
||||
// Sorts by template, preserving original gather order.
|
||||
NEW_CARD_SORT_ORDER_TEMPLATE_ONLY = 6;
|
||||
// Preserves original gather order (eg deck order)
|
||||
NEW_CARD_SORT_ORDER_NO_SORT = 7;
|
||||
}
|
||||
enum ReviewCardOrder {
|
||||
REVIEW_CARD_ORDER_DAY = 0;
|
||||
|
|
|
@ -26,6 +26,14 @@ impl QueueBuilder {
|
|||
self.new.iter_mut().for_each(NewCard::hash_id_and_mtime);
|
||||
self.new.sort_unstable_by(new_hash)
|
||||
}
|
||||
NewCardSortOrder::TemplateOnly => {
|
||||
// stable sort to preserve gather order
|
||||
self.new
|
||||
.sort_by(|a, b| a.template_index.cmp(&b.template_index))
|
||||
}
|
||||
NewCardSortOrder::NoSort => {
|
||||
// preserve gather order
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -31,6 +31,8 @@ License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
|
|||
tr.deckConfigSortOrderLowestPosition(),
|
||||
tr.deckConfigSortOrderHighestPosition(),
|
||||
tr.deckConfigSortOrderRandom(),
|
||||
tr.deckConfigSortOrderTemplateThenGather(),
|
||||
tr.deckConfigSortOrderGather(),
|
||||
];
|
||||
const reviewOrderChoices = [
|
||||
tr.deckConfigSortOrderDueDateThenRandom(),
|
||||
|
|
Loading…
Reference in a new issue