This commit is contained in:
Daniel 2023-11-23 11:37:49 +08:00
parent aeb7ace58d
commit 183621ea00
No known key found for this signature in database
GPG key ID: 86211BA83DF03017

View file

@ -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())