mirror of
https://github.com/siyuan-note/siyuan.git
synced 2026-01-06 00:38:49 +01:00
🎨 The database rollup field supports using the updated/created field https://github.com/siyuan-note/siyuan/issues/15662
This commit is contained in:
parent
ee95f9bf6f
commit
9bb6f4d134
6 changed files with 54 additions and 44 deletions
|
|
@ -796,21 +796,16 @@ type ValueRollup struct {
|
|||
Contents []*Value `json:"contents"`
|
||||
}
|
||||
|
||||
func (r *ValueRollup) BuildContents(destAv *AttributeView, destKey *Key, relationVal *Value, calc *RollupCalc, furtherCollection Collection) {
|
||||
func (r *ValueRollup) BuildContents(keyValues []*KeyValues, destKey *Key, relationVal *Value, calc *RollupCalc, furtherCollection Collection) {
|
||||
r.Contents = nil
|
||||
for _, blockID := range relationVal.Relation.BlockIDs {
|
||||
destVal := destAv.GetValue(destKey.ID, blockID)
|
||||
destVal := GetValue(keyValues, destKey.ID, blockID)
|
||||
if nil != furtherCollection && KeyTypeTemplate == destKey.Type {
|
||||
destVal = furtherCollection.GetValue(blockID, destKey.ID)
|
||||
}
|
||||
|
||||
if nil == destVal {
|
||||
if destAv.ExistItem(blockID) { // 数据库中存在项目但是字段值不存在是数据未初始化,这里补一个默认值
|
||||
destVal = GetAttributeViewDefaultValue(ast.NewNodeID(), destKey.ID, blockID, destKey.Type)
|
||||
}
|
||||
if nil == destVal {
|
||||
continue
|
||||
}
|
||||
continue
|
||||
}
|
||||
if KeyTypeNumber == destKey.Type {
|
||||
destVal.Number.Format = destKey.NumberFormat
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue