I’ve written the following function to sort the cards within a group of filtered decks (all within the parent deck ‘Study Ahead’):
def sort_cards(): ids = mw.col.find_cards('deck:"Study Ahead" deck:filtered') ids = sorted(ids, key=lambda card_id: underdue_ratio(card_id, mw)) cards = [mw.col.get_card(id) for id in ids] for i, card in enumerate(cards): card.due = int((-10000)+i) mw.col.update_cards(cards)
This is based on Dae’s comment in this topic which suggests ordering them by inputting negative numbers into the due field, which are replaced with the original due dates when returned to their parent deck.
Is this still the best way to do it? Will this cause any issues on other platforms that might handled filtered deck ordering differently?