mirror of
https://github.com/siyuan-note/siyuan.git
synced 2025-12-16 14:40:12 +01:00
🎨 Improve database rollup field filtering https://github.com/siyuan-note/siyuan/issues/15740
This commit is contained in:
parent
7b2e48d54e
commit
04c46b3a56
5 changed files with 69 additions and 57 deletions
|
|
@ -518,6 +518,45 @@ func fillAttributeViewAutoGeneratedValues(attrView *av.AttributeView, collection
|
|||
}
|
||||
}
|
||||
|
||||
func GetFurtherCollections(attrView *av.AttributeView, cachedAttrViews map[string]*av.AttributeView) (ret map[string]av.Collection) {
|
||||
ret = map[string]av.Collection{}
|
||||
for _, kv := range attrView.KeyValues {
|
||||
if av.KeyTypeRollup != kv.Key.Type {
|
||||
continue
|
||||
}
|
||||
|
||||
relKey, _ := attrView.GetKey(kv.Key.Rollup.RelationKeyID)
|
||||
if nil == relKey {
|
||||
continue
|
||||
}
|
||||
|
||||
destAv := cachedAttrViews[relKey.Relation.AvID]
|
||||
if nil == destAv {
|
||||
destAv, _ = av.ParseAttributeView(relKey.Relation.AvID)
|
||||
if nil == destAv {
|
||||
continue
|
||||
}
|
||||
cachedAttrViews[relKey.Relation.AvID] = destAv
|
||||
}
|
||||
|
||||
destKey, _ := destAv.GetKey(kv.Key.Rollup.KeyID)
|
||||
if nil == destKey {
|
||||
continue
|
||||
}
|
||||
isSameAv := destAv.ID == attrView.ID
|
||||
|
||||
var furtherCollection av.Collection
|
||||
if av.KeyTypeTemplate == destKey.Type || (!isSameAv && (av.KeyTypeUpdated == destKey.Type || av.KeyTypeCreated == destKey.Type)) {
|
||||
viewable := RenderView(destAv, destAv.Views[0], "")
|
||||
if nil != viewable {
|
||||
furtherCollection = viewable.(av.Collection)
|
||||
}
|
||||
}
|
||||
ret[kv.Key.ID] = furtherCollection
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
func fillAttributeViewTemplateValues(attrView *av.AttributeView, view *av.View, collection av.Collection, ials map[string]map[string]string) (err error) {
|
||||
items := generateAttrViewItems(attrView, view)
|
||||
existTemplateField := false
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue