mirror of
https://github.com/siyuan-note/siyuan.git
synced 2025-12-23 01:50:12 +01:00
Sort by Due asc on the flashcard management UI (#9673)
This commit is contained in:
parent
18f9f2633a
commit
afaf88d525
1 changed files with 7 additions and 1 deletions
|
|
@ -329,11 +329,17 @@ func getCardsBlocks(cards []riff.Card, page int) (blocks []*Block, total, pageCo
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// sort by due date asc
|
||||||
|
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
|
var blockIDs []string
|
||||||
for _, card := range cards {
|
for _, card := range cards {
|
||||||
blockIDs = append(blockIDs, card.BlockID())
|
blockIDs = append(blockIDs, card.BlockID())
|
||||||
}
|
}
|
||||||
sort.Strings(blockIDs)
|
|
||||||
|
|
||||||
sqlBlocks := sql.GetBlocks(blockIDs)
|
sqlBlocks := sql.GetBlocks(blockIDs)
|
||||||
blocks = fromSQLBlocks(&sqlBlocks, "", 36)
|
blocks = fromSQLBlocks(&sqlBlocks, "", 36)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue