mirror of
https://github.com/siyuan-note/siyuan.git
synced 2025-09-22 00:20:47 +02:00
🎨 The database rollup field supports using the template field https://github.com/siyuan-note/siyuan/issues/12384
This commit is contained in:
parent
b78616382b
commit
04351d74bc
1 changed files with 13 additions and 0 deletions
|
@ -1470,8 +1470,21 @@ func GetBlockAttributeViewKeys(nodeID string) (ret []*BlockAttributeViewKeys) {
|
|||
|
||||
destKey, _ := destAv.GetKey(kv.Key.Rollup.KeyID)
|
||||
if nil != destKey {
|
||||
var furtherCollection av.Collection
|
||||
if av.KeyTypeTemplate == destKey.Type {
|
||||
// 渲染目标视图,这样才能汇总渲染后的模板字段值
|
||||
viewable := sql.RenderView(destAv, destAv.Views[0], "")
|
||||
if nil != viewable {
|
||||
furtherCollection = viewable.(av.Collection)
|
||||
}
|
||||
}
|
||||
|
||||
for _, bID := range relVal.Relation.BlockIDs {
|
||||
destVal := destAv.GetValue(kv.Key.Rollup.KeyID, bID)
|
||||
if nil != furtherCollection && av.KeyTypeTemplate == destKey.Type {
|
||||
destVal = furtherCollection.GetValue(bID, destKey.ID)
|
||||
}
|
||||
|
||||
if nil == destVal {
|
||||
if destAv.ExistItem(bID) { // 数据库中存在项目但是字段值不存在是数据未初始化,这里补一个默认值
|
||||
destVal = av.GetAttributeViewDefaultValue(ast.NewNodeID(), kv.Key.Rollup.KeyID, bID, destKey.Type)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue