Skip to content

An open-source, privacy-first, self-hosted knowledge workspace where humans and AI agents work together 开源、隐私优先、自托管的知识工作空间,让人与智能体在此协作

:art: The database rollup field supports using the updated/created field https://github.com/siyuan-note/siyuan/issues/15662

Danielc2075e6387ca
diff --git a/kernel/av/value.go b/kernel/av/value.go
index 020c06d467..f693091cc3 100644
--- a/kernel/av/value.go
+++ b/kernel/av/value.go
@@ -800,7 +800,7 @@ func (r *ValueRollup) BuildContents(keyValues []*KeyValues, destKey *Key, relati
r.Contents = nil
for _, blockID := range relationVal.Relation.BlockIDs {
destVal := GetValue(keyValues, destKey.ID, blockID)
- if nil != furtherCollection && KeyTypeTemplate == destKey.Type {
+ if nil != furtherCollection && (KeyTypeTemplate == destKey.Type || KeyTypeUpdated == destKey.Type || KeyTypeCreated == destKey.Type) {
destVal = furtherCollection.GetValue(blockID, destKey.ID)
}
diff --git a/kernel/model/attribute_view.go b/kernel/model/attribute_view.go
index e87fc2a436..4a1af61e85 100644
--- a/kernel/model/attribute_view.go
+++ b/kernel/model/attribute_view.go
@@ -1551,9 +1551,9 @@ func GetBlockAttributeViewKeys(nodeID string) (ret []*BlockAttributeViewKeys) {
destKey, _ := destAv.GetKey(kv.Key.Rollup.KeyID)
if nil != destKey {
+ isSameAv := destAv.ID == attrView.ID
var furtherCollection av.Collection
- if av.KeyTypeTemplate == destKey.Type {
- // 渲染目标视图,这样才能汇总渲染后的模板字段值
+ if av.KeyTypeTemplate == destKey.Type || (!isSameAv && (av.KeyTypeUpdated == destKey.Type || av.KeyTypeCreated == destKey.Type)) {
viewable := sql.RenderView(destAv, destAv.Views[0], "")
if nil != viewable {
furtherCollection = viewable.(av.Collection)
diff --git a/kernel/sql/av.go b/kernel/sql/av.go
index b6283b3773..f69a003e87 100644
--- a/kernel/sql/av.go
+++ b/kernel/sql/av.go
@@ -437,9 +437,9 @@ func fillAttributeViewAutoGeneratedValues(attrView *av.AttributeView, collection
break
}
+ isSameAv := destAv.ID == attrView.ID
var furtherCollection av.Collection
- if av.KeyTypeTemplate == destKey.Type {
- // 渲染目标视图,这样才能汇总渲染后的模板字段值
+ if av.KeyTypeTemplate == destKey.Type || (!isSameAv && (av.KeyTypeUpdated == destKey.Type || av.KeyTypeCreated == destKey.Type)) {
viewable := renderView(destAv, destAv.Views[0], "", depth, renderedAttrViews)
if nil != viewable {
furtherCollection = viewable.(av.Collection)