浏览代码

Merge remote-tracking branch 'origin/dev' into dev

Vanessa 1 年之前
父节点
当前提交
b77d27b91a
共有 2 个文件被更改,包括 10 次插入4 次删除
  1. 4 4
      kernel/av/sort.go
  2. 6 0
      kernel/model/attribute_view.go

+ 4 - 4
kernel/av/sort.go

@@ -233,8 +233,8 @@ func (value *Value) Compare(other *Value, attrView *AttributeView) int {
 			}
 			oContent := strings.TrimSpace(oContentBuf.String())
 
-			v1, ok1 := util.Convert2Float(value.Template.Content)
-			v2, ok2 := util.Convert2Float(other.Template.Content)
+			v1, ok1 := util.Convert2Float(vContent)
+			v2, ok2 := util.Convert2Float(oContent)
 			if ok1 && ok2 {
 				if v1 > v2 {
 					return 1
@@ -262,8 +262,8 @@ func (value *Value) Compare(other *Value, attrView *AttributeView) int {
 			}
 			oContent := strings.TrimSpace(oContentBuf.String())
 
-			v1, ok1 := util.Convert2Float(value.Template.Content)
-			v2, ok2 := util.Convert2Float(other.Template.Content)
+			v1, ok1 := util.Convert2Float(vContent)
+			v2, ok2 := util.Convert2Float(oContent)
 			if ok1 && ok2 {
 				if v1 > v2 {
 					return 1

+ 6 - 0
kernel/model/attribute_view.go

@@ -3003,6 +3003,12 @@ func UpdateAttributeViewCell(tx *Transaction, avID, keyID, rowID, cellID string,
 		return
 	}
 
+	if "" == val.ID {
+		// 有时前端会误调用该接口(比如创建完快速切换),这里判断一下,避免误更新刚刚创建的值
+		// Primary key value unexpectedly updated when database adds row https://github.com/siyuan-note/siyuan/issues/11018
+		return
+	}
+
 	if av.KeyTypeNumber == val.Type {
 		if nil != val.Number && !val.Number.IsNotEmpty {
 			val.Number.Content = 0