🎨 Sort by Due asc on the flashcard management UI https://github.com/siyuan-note/siyuan/pull/9673#issuecomment-1823003087
This commit is contained in:
parent
aeb7ace58d
commit
183621ea00
1 changed files with 6 additions and 8 deletions
|
@ -309,7 +309,12 @@ func GetDeckFlashcards(deckID string, page int) (blocks []*Block, total, pageCou
|
|||
}
|
||||
|
||||
func getCardsBlocks(cards []riff.Card, page int) (blocks []*Block, total, pageCount int) {
|
||||
sort.Slice(cards, func(i, j int) bool { return cards[i].BlockID() < cards[j].BlockID() })
|
||||
// sort by due date asc https://github.com/siyuan-note/siyuan/pull/9673
|
||||
sort.Slice(cards, func(i, j int) bool {
|
||||
due1 := cards[i].(*riff.FSRSCard).C.Due
|
||||
due2 := cards[j].(*riff.FSRSCard).C.Due
|
||||
return due1.Before(due2)
|
||||
})
|
||||
|
||||
const pageSize = 20
|
||||
total = len(cards)
|
||||
|
@ -329,13 +334,6 @@ func getCardsBlocks(cards []riff.Card, page int) (blocks []*Block, total, pageCo
|
|||
return
|
||||
}
|
||||
|
||||
// sort by due date asc https://github.com/siyuan-note/siyuan/pull/9673
|
||||
sort.Slice(cards, func(i, j int) bool {
|
||||
due1 := cards[i].(*riff.FSRSCard).C.Due
|
||||
due2 := cards[j].(*riff.FSRSCard).C.Due
|
||||
return due1.Before(due2)
|
||||
})
|
||||
|
||||
var blockIDs []string
|
||||
for _, card := range cards {
|
||||
blockIDs = append(blockIDs, card.BlockID())
|
||||
|
|
Loading…
Add table
Reference in a new issue