mirror of
https://github.com/siyuan-note/siyuan.git
synced 2026-02-26 08:54:07 +01:00
🐛 Database table view sorts abnormally after deleting numeric values Fix https://github.com/siyuan-note/siyuan/issues/10476
This commit is contained in:
parent
1635b4b8c2
commit
a650764c12
2 changed files with 29 additions and 1 deletions
|
|
@ -101,6 +101,18 @@ func (value *Value) Compare(other *Value) int {
|
|||
}
|
||||
case KeyTypeNumber:
|
||||
if nil != value.Number && nil != other.Number {
|
||||
if value.Number.IsNotEmpty {
|
||||
if !other.Number.IsNotEmpty {
|
||||
return 1
|
||||
}
|
||||
return 0
|
||||
} else {
|
||||
if other.Number.IsNotEmpty {
|
||||
return -1
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
if value.Number.Content > other.Number.Content {
|
||||
return 1
|
||||
} else if value.Number.Content < other.Number.Content {
|
||||
|
|
@ -111,6 +123,18 @@ func (value *Value) Compare(other *Value) int {
|
|||
}
|
||||
case KeyTypeDate:
|
||||
if nil != value.Date && nil != other.Date {
|
||||
if value.Date.IsNotEmpty {
|
||||
if !other.Date.IsNotEmpty {
|
||||
return 1
|
||||
}
|
||||
return 0
|
||||
} else {
|
||||
if other.Date.IsNotEmpty {
|
||||
return -1
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
if value.Date.Content > other.Date.Content {
|
||||
return 1
|
||||
} else if value.Date.Content < other.Date.Content {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue