Merge remote-tracking branch 'origin/dev' into dev
This commit is contained in:
commit
6badfc4d1c
4 changed files with 30 additions and 6 deletions
|
@ -91,10 +91,11 @@ func (value *Value) Compare(other *Value) int {
|
|||
}
|
||||
|
||||
if !value.IsEdited() {
|
||||
return 1
|
||||
}
|
||||
|
||||
if !other.IsEdited() {
|
||||
if other.IsEdited() {
|
||||
return 1
|
||||
}
|
||||
return int(value.CreatedAt - other.CreatedAt)
|
||||
} else if !other.IsEdited() {
|
||||
return -1
|
||||
}
|
||||
|
||||
|
|
|
@ -184,8 +184,12 @@ func (value *Value) Clone() (ret *Value) {
|
|||
}
|
||||
|
||||
func (value *Value) IsEdited() bool {
|
||||
if 1709454120000 > value.CreatedAt {
|
||||
// 说明是旧数据,认为都是编辑过的
|
||||
return true
|
||||
}
|
||||
|
||||
if value.CreatedAt == value.UpdatedAt {
|
||||
// 说明是刚刚创建的块
|
||||
return false
|
||||
}
|
||||
return true
|
||||
|
|
|
@ -2594,12 +2594,15 @@ func UpdateAttributeViewCell(tx *Transaction, avID, keyID, rowID, cellID string,
|
|||
}
|
||||
}
|
||||
|
||||
now := time.Now().UnixMilli()
|
||||
if nil != blockVal {
|
||||
blockVal.Block.Updated = time.Now().UnixMilli()
|
||||
blockVal.Block.Updated = now
|
||||
blockVal.UpdatedAt = now
|
||||
if isUpdatingBlockKey {
|
||||
blockVal.IsDetached = val.IsDetached
|
||||
}
|
||||
}
|
||||
val.UpdatedAt = now
|
||||
|
||||
key, _ := attrView.GetKey(val.KeyID)
|
||||
if nil != key && av.KeyTypeRelation == key.Type && nil != key.Relation {
|
||||
|
|
|
@ -976,7 +976,23 @@ func FillAttributeViewTableCellNilValue(tableCell *av.TableCell, rowID, colID st
|
|||
}
|
||||
|
||||
func GetAttributeViewDefaultValue(valueID, keyID, blockID string, typ av.KeyType) (ret *av.Value) {
|
||||
if "" == valueID {
|
||||
valueID = ast.NewNodeID()
|
||||
}
|
||||
|
||||
ret = &av.Value{ID: valueID, KeyID: keyID, BlockID: blockID, Type: typ}
|
||||
|
||||
createdStr := valueID[:len("20060102150405")]
|
||||
created, parseErr := time.ParseInLocation("20060102150405", createdStr, time.Local)
|
||||
if nil == parseErr {
|
||||
ret.CreatedAt = created.UnixMilli()
|
||||
} else {
|
||||
ret.CreatedAt = time.Now().UnixMilli()
|
||||
}
|
||||
if 0 == ret.UpdatedAt {
|
||||
ret.UpdatedAt = ret.CreatedAt
|
||||
}
|
||||
|
||||
switch typ {
|
||||
case av.KeyTypeText:
|
||||
ret.Text = &av.ValueText{}
|
||||
|
|
Loading…
Add table
Reference in a new issue