🎨 Improve database null value field sorting Fix https://github.com/siyuan-note/siyuan/issues/10951

This commit is contained in:
Daniel 2024-04-09 23:37:00 +08:00
parent 5e116a16d2
commit 59d7b4dfc5
No known key found for this signature in database
GPG key ID: 86211BA83DF03017
4 changed files with 7 additions and 7 deletions

View file

@ -431,7 +431,7 @@ func SaveAttributeView(av *AttributeView) (err error) {
}
if 0 == v.UpdatedAt {
v.UpdatedAt = v.CreatedAt + 1000
v.UpdatedAt = v.CreatedAt
}
}
}

View file

@ -74,9 +74,9 @@ func (value *Value) Compare(other *Value, attrView *AttributeView) int {
return 0
} else {
if !other.Number.IsNotEmpty {
return 0
return 1
}
return 1
return 0
}
}
case KeyTypeDate:
@ -94,9 +94,9 @@ func (value *Value) Compare(other *Value, attrView *AttributeView) int {
return 0
} else {
if !other.Date.IsNotEmpty {
return 0
return 1
}
return 1
return 0
}
}
case KeyTypeCreated:

View file

@ -774,7 +774,7 @@ func renderAttributeView(attrView *av.AttributeView, viewID, query string, page,
}
if 0 == v.UpdatedAt {
v.UpdatedAt = v.CreatedAt + 1000
v.UpdatedAt = v.CreatedAt
}
}
}

View file

@ -954,7 +954,7 @@ func GetAttributeViewDefaultValue(valueID, keyID, blockID string, typ av.KeyType
ret.CreatedAt = time.Now().UnixMilli()
}
if 0 == ret.UpdatedAt {
ret.UpdatedAt = ret.CreatedAt + 1000
ret.UpdatedAt = ret.CreatedAt
}
switch typ {