add options to sort reviews by deck

https://forums.ankiweb.net/t/is-studying-subdeck-by-subdeck-broken-in-2-1-44-mac/10458/2
This commit is contained in:
Damien Elmes 2021-06-01 13:22:39 +10:00
parent 775beda6ce
commit 562787bce1
6 changed files with 23 additions and 10 deletions

View File

@ -122,8 +122,11 @@ deck-config-review-sort-order-tooltip =
The default order prioritizes cards that have been waiting longest, so that
if you have a backlog of reviews, the longest-waiting ones will appear
first. If you have a large backlog that will take more than a few days to
clear, you may find the alternate sort orders preferable.
clear, or wish to see cards in subdeck order, you may find the alternate
sort orders preferable.
deck-config-sort-order-due-date-then-random = Due date, then random
deck-config-sort-order-due-date-then-deck = Due date, then deck
deck-config-sort-order-deck-then-due-date = Deck, then due date
deck-config-sort-order-ascending-intervals = Ascending intervals
deck-config-sort-order-descending-intervals = Descending intervals

View File

@ -329,9 +329,11 @@ message DeckConfig {
NEW_CARD_SORT_ORDER_RANDOM = 3;
}
enum ReviewCardOrder {
REVIEW_CARD_ORDER_DAY_THEN_RANDOM = 0;
REVIEW_CARD_ORDER_INTERVALS_ASCENDING = 1;
REVIEW_CARD_ORDER_INTERVALS_DESCENDING = 2;
REVIEW_CARD_ORDER_DAY = 0;
REVIEW_CARD_ORDER_DAY_THEN_DECK = 1;
REVIEW_CARD_ORDER_DECK_THEN_DAY = 2;
REVIEW_CARD_ORDER_INTERVALS_ASCENDING = 3;
REVIEW_CARD_ORDER_INTERVALS_DESCENDING = 4;
// REVIEW_CARD_ORDER_RELATIVE_OVERDUE = 3;
}
enum ReviewMix {

View File

@ -64,7 +64,7 @@ impl Default for DeckConfig {
new_card_insert_order: NewCardInsertOrder::Due as i32,
new_card_gather_priority: NewCardGatherPriority::Deck as i32,
new_card_sort_order: NewCardSortOrder::TemplateThenDue as i32,
review_order: ReviewCardOrder::DayThenRandom as i32,
review_order: ReviewCardOrder::Day as i32,
new_mix: ReviewMix::MixWithReviews as i32,
interday_learning_mix: ReviewMix::MixWithReviews as i32,
leech_action: LeechAction::TagOnly as i32,

View File

@ -32,7 +32,7 @@ impl QueueBuilder {
self.day_learning.sort_unstable_by(day_then_hash);
// other sorting is done in SQL
if self.sort_options.review_order == ReviewCardOrder::DayThenRandom {
if self.sort_options.review_order == ReviewCardOrder::Day {
self.review.iter_mut().for_each(DueCard::hash_id_and_mtime);
self.review.sort_unstable_by(day_then_hash);
}

View File

@ -200,12 +200,18 @@ impl super::SqliteStorage {
F: FnMut(CardQueue, DueCard) -> bool,
{
let order_clause = match order {
ReviewCardOrder::DayThenRandom => "order by due",
ReviewCardOrder::IntervalsAscending => "order by ivl asc",
ReviewCardOrder::IntervalsDescending => "order by ivl desc",
ReviewCardOrder::Day => "due",
ReviewCardOrder::DayThenDeck => {
"due, (select rowid from active_decks ad where ad.id = did)"
}
ReviewCardOrder::DeckThenDay => {
"(select rowid from active_decks ad where ad.id = did), due"
}
ReviewCardOrder::IntervalsAscending => "ivl asc",
ReviewCardOrder::IntervalsDescending => "ivl desc",
};
let mut stmt = self.db.prepare_cached(&format!(
"{} {}",
"{} order by {}",
include_str!("due_cards.sql"),
order_clause
))?;

View File

@ -25,6 +25,8 @@ License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
];
const reviewOrderChoices = [
tr.deckConfigSortOrderDueDateThenRandom(),
tr.deckConfigSortOrderDueDateThenDeck(),
tr.deckConfigSortOrderDeckThenDueDate(),
tr.deckConfigSortOrderAscendingIntervals(),
tr.deckConfigSortOrderDescendingIntervals(),
];