Merge remote-tracking branch 'origin/dev' into dev
This commit is contained in:
commit
8ed32fe65f
5 changed files with 31 additions and 14 deletions
|
@ -14,6 +14,7 @@ Below are the detailed changes in this version.
|
|||
* [`Create doc above/below` function can also be used when notebook is custom sort](https://github.com/siyuan-note/siyuan/issues/10381)
|
||||
* [Improve cursor position after deletion](https://github.com/siyuan-note/siyuan/issues/10389)
|
||||
* [Improve deletion of the empty block below thematic breaks](https://github.com/siyuan-note/siyuan/issues/10393)
|
||||
* [Improve the performance of pop-up windows when creating columns in the database](https://github.com/siyuan-note/siyuan/issues/10394)
|
||||
* [Floating window remains displayed while it has menu](https://github.com/siyuan-note/siyuan/issues/10397)
|
||||
* [Update outline after closing all editors](https://github.com/siyuan-note/siyuan/issues/10400)
|
||||
* [Candidate values of the database relation fields are no longer subject to view filtering](https://github.com/siyuan-note/siyuan/issues/10411)
|
||||
|
@ -41,6 +42,7 @@ Below are the detailed changes in this version.
|
|||
|
||||
* [Improve internal kernel API `/api/attr/batchSetBlockAttrs`](https://github.com/siyuan-note/siyuan/issues/10401)
|
||||
* [Add internal kernel API `/api/riff/batchSetRiffCardsDueTime`](https://github.com/siyuan-note/siyuan/issues/10423)
|
||||
* [Add parameter `pageSize` for kernel API `/api/riff/getRiffCards`](https://github.com/siyuan-note/siyuan/issues/10445)
|
||||
|
||||
## Download
|
||||
|
||||
|
|
|
@ -14,6 +14,7 @@
|
|||
* [`上方/下方新文件` 功能在筆記本等級自訂排序時可用](https://github.com/siyuan-note/siyuan/issues/10381)
|
||||
* [改進刪除作業後的遊標位置](https://github.com/siyuan-note/siyuan/issues/10389)
|
||||
* [改進分隔線下方空格刪除操作](https://github.com/siyuan-note/siyuan/issues/10393)
|
||||
* [改進資料庫建立列時彈出視窗的效能](https://github.com/siyuan-note/siyuan/issues/10394)
|
||||
* [浮窗中有選單時保持顯示](https://github.com/siyuan-note/siyuan/issues/10397)
|
||||
* [關閉所有編輯器後更新大綱](https://github.com/siyuan-note/siyuan/issues/10400)
|
||||
* [資料庫關聯欄位候選值不再受視圖過濾影響](https://github.com/siyuan-note/siyuan/issues/10411)
|
||||
|
@ -41,6 +42,7 @@
|
|||
|
||||
* [改進內部核心 API `/api/attr/batchSetBlockAttrs`](https://github.com/siyuan-note/siyuan/issues/10401)
|
||||
* [新增內部核心 API `/api/riff/batchSetRiffCardsDueTime`](https://github.com/siyuan-note/siyuan/issues/10423)
|
||||
* [核心 API `/api/riff/getRiffCards` 新增參數 `pageSize`](https://github.com/siyuan-note/siyuan/issues/10445)
|
||||
|
||||
## 下載
|
||||
|
||||
|
|
|
@ -14,6 +14,7 @@
|
|||
* [`在上方/下方新建文档` 功能在笔记本级自定义排序时可用](https://github.com/siyuan-note/siyuan/issues/10381)
|
||||
* [改进删除操作后的光标位置](https://github.com/siyuan-note/siyuan/issues/10389)
|
||||
* [改进分隔线下方空格删除操作](https://github.com/siyuan-note/siyuan/issues/10393)
|
||||
* [改进数据库创建列时弹出窗口的性能](https://github.com/siyuan-note/siyuan/issues/10394)
|
||||
* [浮窗中有菜单时保持显示](https://github.com/siyuan-note/siyuan/issues/10397)
|
||||
* [关闭所有编辑器后更新大纲](https://github.com/siyuan-note/siyuan/issues/10400)
|
||||
* [数据库关联字段候选值不再受视图过滤影响](https://github.com/siyuan-note/siyuan/issues/10411)
|
||||
|
@ -41,6 +42,7 @@
|
|||
|
||||
* [改进内部内核 API `/api/attr/batchSetBlockAttrs`](https://github.com/siyuan-note/siyuan/issues/10401)
|
||||
* [添加内部内核 API `/api/riff/batchSetRiffCardsDueTime`](https://github.com/siyuan-note/siyuan/issues/10423)
|
||||
* [内核 API `/api/riff/getRiffCards` 添加参数 `pageSize`](https://github.com/siyuan-note/siyuan/issues/10445)
|
||||
|
||||
## 下载
|
||||
|
||||
|
|
|
@ -86,7 +86,11 @@ func getNotebookRiffCards(c *gin.Context) {
|
|||
|
||||
notebookID := arg["id"].(string)
|
||||
page := int(arg["page"].(float64))
|
||||
blockIDs, total, pageCount := model.GetNotebookFlashcards(notebookID, page)
|
||||
pageSize := 20
|
||||
if nil != arg["pageSize"] {
|
||||
pageSize = int(arg["pageSize"].(float64))
|
||||
}
|
||||
blockIDs, total, pageCount := model.GetNotebookFlashcards(notebookID, page, pageSize)
|
||||
ret.Data = map[string]interface{}{
|
||||
"blocks": blockIDs,
|
||||
"total": total,
|
||||
|
@ -105,7 +109,11 @@ func getTreeRiffCards(c *gin.Context) {
|
|||
|
||||
rootID := arg["id"].(string)
|
||||
page := int(arg["page"].(float64))
|
||||
blockIDs, total, pageCount := model.GetTreeFlashcards(rootID, page)
|
||||
pageSize := 20
|
||||
if nil != arg["pageSize"] {
|
||||
pageSize = int(arg["pageSize"].(float64))
|
||||
}
|
||||
blockIDs, total, pageCount := model.GetTreeFlashcards(rootID, page, pageSize)
|
||||
ret.Data = map[string]interface{}{
|
||||
"blocks": blockIDs,
|
||||
"total": total,
|
||||
|
@ -124,7 +132,11 @@ func getRiffCards(c *gin.Context) {
|
|||
|
||||
deckID := arg["id"].(string)
|
||||
page := int(arg["page"].(float64))
|
||||
blocks, total, pageCount := model.GetDeckFlashcards(deckID, page)
|
||||
pageSize := 20
|
||||
if nil != arg["pageSize"] {
|
||||
pageSize = int(arg["pageSize"].(float64))
|
||||
}
|
||||
blocks, total, pageCount := model.GetDeckFlashcards(deckID, page, pageSize)
|
||||
ret.Data = map[string]interface{}{
|
||||
"blocks": blocks,
|
||||
"total": total,
|
||||
|
|
|
@ -109,7 +109,7 @@ func ResetFlashcards(typ, id, deckID string, blockIDs []string) {
|
|||
switch typ {
|
||||
case "notebook":
|
||||
for i := 1; ; i++ {
|
||||
pagedBlocks, _, _ := GetNotebookFlashcards(id, i)
|
||||
pagedBlocks, _, _ := GetNotebookFlashcards(id, i, 20)
|
||||
if 1 > len(pagedBlocks) {
|
||||
break
|
||||
}
|
||||
|
@ -120,7 +120,7 @@ func ResetFlashcards(typ, id, deckID string, blockIDs []string) {
|
|||
}
|
||||
case "tree":
|
||||
for i := 1; ; i++ {
|
||||
pagedBlocks, _, _ := GetTreeFlashcards(id, i)
|
||||
pagedBlocks, _, _ := GetTreeFlashcards(id, i, 20)
|
||||
if 1 > len(pagedBlocks) {
|
||||
break
|
||||
}
|
||||
|
@ -131,7 +131,7 @@ func ResetFlashcards(typ, id, deckID string, blockIDs []string) {
|
|||
}
|
||||
case "deck":
|
||||
for i := 1; ; i++ {
|
||||
pagedBlocks, _, _ := GetDeckFlashcards(id, i)
|
||||
pagedBlocks, _, _ := GetDeckFlashcards(id, i, 20)
|
||||
if 1 > len(pagedBlocks) {
|
||||
break
|
||||
}
|
||||
|
@ -232,7 +232,7 @@ var (
|
|||
deckLock = sync.Mutex{}
|
||||
)
|
||||
|
||||
func GetNotebookFlashcards(boxID string, page int) (blocks []*Block, total, pageCount int) {
|
||||
func GetNotebookFlashcards(boxID string, page, pageSize int) (blocks []*Block, total, pageCount int) {
|
||||
blocks = []*Block{}
|
||||
|
||||
entries, err := os.ReadDir(filepath.Join(util.DataDir, boxID))
|
||||
|
@ -276,14 +276,14 @@ func GetNotebookFlashcards(boxID string, page int) (blocks []*Block, total, page
|
|||
allBlockIDs = gulu.Str.RemoveDuplicatedElem(allBlockIDs)
|
||||
cards := deck.GetCardsByBlockIDs(allBlockIDs)
|
||||
|
||||
blocks, total, pageCount = getCardsBlocks(cards, page)
|
||||
blocks, total, pageCount = getCardsBlocks(cards, page, pageSize)
|
||||
return
|
||||
}
|
||||
|
||||
func GetTreeFlashcards(rootID string, page int) (blocks []*Block, total, pageCount int) {
|
||||
func GetTreeFlashcards(rootID string, page, pageSize int) (blocks []*Block, total, pageCount int) {
|
||||
blocks = []*Block{}
|
||||
cards := getTreeSubTreeFlashcards(rootID)
|
||||
blocks, total, pageCount = getCardsBlocks(cards, page)
|
||||
blocks, total, pageCount = getCardsBlocks(cards, page, pageSize)
|
||||
return
|
||||
}
|
||||
|
||||
|
@ -325,7 +325,7 @@ func getTreeFlashcards(rootID string) (ret []riff.Card) {
|
|||
return
|
||||
}
|
||||
|
||||
func GetDeckFlashcards(deckID string, page int) (blocks []*Block, total, pageCount int) {
|
||||
func GetDeckFlashcards(deckID string, page, pageSize int) (blocks []*Block, total, pageCount int) {
|
||||
blocks = []*Block{}
|
||||
var cards []riff.Card
|
||||
if "" == deckID {
|
||||
|
@ -343,11 +343,11 @@ func GetDeckFlashcards(deckID string, page int) (blocks []*Block, total, pageCou
|
|||
cards = append(cards, deck.GetCardsByBlockIDs(blockIDs)...)
|
||||
}
|
||||
|
||||
blocks, total, pageCount = getCardsBlocks(cards, page)
|
||||
blocks, total, pageCount = getCardsBlocks(cards, page, pageSize)
|
||||
return
|
||||
}
|
||||
|
||||
func getCardsBlocks(cards []riff.Card, page int) (blocks []*Block, total, pageCount int) {
|
||||
func getCardsBlocks(cards []riff.Card, page, pageSize int) (blocks []*Block, total, pageCount int) {
|
||||
// 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
|
||||
|
@ -355,7 +355,6 @@ func getCardsBlocks(cards []riff.Card, page int) (blocks []*Block, total, pageCo
|
|||
return due1.Before(due2)
|
||||
})
|
||||
|
||||
const pageSize = 20
|
||||
total = len(cards)
|
||||
pageCount = int(math.Ceil(float64(total) / float64(pageSize)))
|
||||
start := (page - 1) * pageSize
|
||||
|
|
Loading…
Add table
Reference in a new issue