mirror of
https://github.com/siyuan-note/siyuan.git
synced 2025-12-16 22:50:13 +01:00
🐛 Database filtering does not work after change the field type https://github.com/siyuan-note/siyuan/issues/10519
This commit is contained in:
parent
b12a125730
commit
3207a5a8a1
2 changed files with 18 additions and 24 deletions
|
|
@ -225,8 +225,9 @@ func getAttributeViewFilterSort(c *gin.Context) {
|
|||
}
|
||||
|
||||
avID := arg["id"].(string)
|
||||
blockID := arg["blockID"].(string)
|
||||
|
||||
filters, sorts := model.GetAttributeViewFilterSort(avID)
|
||||
filters, sorts := model.GetAttributeViewFilterSort(avID, blockID)
|
||||
ret.Data = map[string]interface{}{
|
||||
"filters": filters,
|
||||
"sorts": sorts,
|
||||
|
|
|
|||
|
|
@ -101,23 +101,30 @@ func GetAttributeViewPrimaryKeyValues(avID string, page, pageSize int) (attribut
|
|||
return
|
||||
}
|
||||
|
||||
func GetAttributeViewFilterSort(id string) (filters []*av.ViewFilter, sorts []*av.ViewSort) {
|
||||
func GetAttributeViewFilterSort(avID, blockID string) (filters []*av.ViewFilter, sorts []*av.ViewSort) {
|
||||
waitForSyncingStorages()
|
||||
|
||||
attrView, err := av.ParseAttributeView(id)
|
||||
attrView, err := av.ParseAttributeView(avID)
|
||||
if nil != err {
|
||||
logging.LogErrorf("parse attribute view [%s] failed: %s", id, err)
|
||||
logging.LogErrorf("parse attribute view [%s] failed: %s", avID, err)
|
||||
return
|
||||
}
|
||||
|
||||
view, err := getAttrViewViewByBlockID(attrView, blockID)
|
||||
if nil == view {
|
||||
view, err = attrView.GetCurrentView(attrView.ViewID)
|
||||
if nil != err {
|
||||
logging.LogErrorf("get current view failed: %s", err)
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
filters = []*av.ViewFilter{}
|
||||
sorts = []*av.ViewSort{}
|
||||
for _, view := range attrView.Views {
|
||||
switch view.LayoutType {
|
||||
case av.LayoutTypeTable:
|
||||
filters = view.Table.Filters
|
||||
sorts = view.Table.Sorts
|
||||
}
|
||||
switch view.LayoutType {
|
||||
case av.LayoutTypeTable:
|
||||
filters = view.Table.Filters
|
||||
sorts = view.Table.Sorts
|
||||
}
|
||||
return
|
||||
}
|
||||
|
|
@ -1911,20 +1918,6 @@ func addAttributeViewBlock(avID, blockID, previousBlockID, addingBlockID string,
|
|||
return
|
||||
}
|
||||
|
||||
func GetLastSortRow(rows []*av.TableRow) *av.TableRow {
|
||||
for i := len(rows) - 1; i >= 0; i-- {
|
||||
row := rows[i]
|
||||
blockVal := row.GetBlockValue()
|
||||
if nil != blockVal {
|
||||
if !blockVal.IsEdited() {
|
||||
continue
|
||||
}
|
||||
return row
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (tx *Transaction) doRemoveAttrViewBlock(operation *Operation) (ret *TxErr) {
|
||||
err := removeAttributeViewBlock(operation.SrcIDs, operation.AvID, tx)
|
||||
if nil != err {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue