Files
flashmed-student/src/components/decks/utils.js
2026-08-08 18:56:53 +03:30

19 lines
533 B
JavaScript

export function getStudentDeckComparator(priority = null) {
return function compareStudentDeck(sd1, sd2) {
return (
(priority && sd2.deck.prioritized - sd1.deck.prioritized) ||
sd2.reviewCardCount - sd1.reviewCardCount ||
sd2.newCardCount - sd1.newCardCount ||
sd2.deck.cardCount - sd1.deck.cardCount
);
};
}
export function compareChapter(ch1, ch2) {
return (
ch2.reviewCardCount - ch1.reviewCardCount ||
ch2.newCardCount - ch1.newCardCount ||
ch2.cardCount - ch1.cardCount
);
}