19 lines
533 B
JavaScript
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
|
|
);
|
|
}
|