mirror of
https://github.com/siyuan-note/siyuan.git
synced 2025-12-24 02:20:13 +01:00
🐛 Abnormal sorting of database relation fields https://github.com/siyuan-note/siyuan/issues/10835
This commit is contained in:
parent
5e95593f51
commit
eae61fd4a7
4 changed files with 16 additions and 14 deletions
|
|
@ -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
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue