🐛 Abnormal sorting of database relation fields https://github.com/siyuan-note/siyuan/issues/10835

This commit is contained in:
Daniel 2024-04-03 10:54:23 +08:00
parent 5e95593f51
commit eae61fd4a7
No known key found for this signature in database
GPG key ID: 86211BA83DF03017
4 changed files with 16 additions and 14 deletions

View file

@ -687,7 +687,7 @@ func renderAttributeView(attrView *av.AttributeView, viewID, query string, page,
}
if 0 == v.UpdatedAt {
v.UpdatedAt = v.CreatedAt
v.UpdatedAt = v.CreatedAt + 1000
}
}
}
@ -2913,18 +2913,12 @@ func UpdateAttributeViewCell(tx *Transaction, avID, keyID, rowID, cellID string,
if nil != blockVal {
blockVal.Block.Updated = now
blockVal.UpdatedAt = now
if val.CreatedAt == val.UpdatedAt {
val.UpdatedAt += 1000 // 防止更新时间和创建时间一样
}
blockVal.SetUpdatedAt(now)
if isUpdatingBlockKey {
blockVal.IsDetached = val.IsDetached
}
}
val.UpdatedAt = now
if val.CreatedAt == val.UpdatedAt {
val.UpdatedAt += 1000 // 防止更新时间和创建时间一样
}
val.SetUpdatedAt(now)
key, _ := attrView.GetKey(val.KeyID)
if nil != key && av.KeyTypeRelation == key.Type && nil != key.Relation {
@ -2956,6 +2950,7 @@ func UpdateAttributeViewCell(tx *Transaction, avID, keyID, rowID, cellID string,
destVal.Relation.BlockIDs = append(destVal.Relation.BlockIDs, rowID)
destVal.Relation.BlockIDs = gulu.Str.RemoveDuplicatedElem(destVal.Relation.BlockIDs)
destVal.SetUpdatedAt(now)
break
}
}
@ -2974,6 +2969,7 @@ func UpdateAttributeViewCell(tx *Transaction, avID, keyID, rowID, cellID string,
for _, value := range keyValues.Values {
if value.BlockID == blockID {
value.Relation.BlockIDs = gulu.Str.RemoveElem(value.Relation.BlockIDs, rowID)
value.SetUpdatedAt(now)
break
}
}