🎨 Improve database table view template col sorting https://ld246.com/article/1702871433047

This commit is contained in:
Daniel 2023-12-20 11:12:31 +08:00
parent 28c7f6df7f
commit 305f781afa
No known key found for this signature in database
GPG key ID: 86211BA83DF03017

View file

@ -176,9 +176,11 @@ func (value *Value) Compare(other *Value) int {
}
case KeyTypeTemplate:
if nil != value.Template && nil != other.Template {
if util.IsNumeric(value.Template.Content) && util.IsNumeric(other.Template.Content) {
v1, _ := strconv.ParseFloat(value.Template.Content, 64)
v2, _ := strconv.ParseFloat(other.Template.Content, 64)
vContent := strings.TrimSpace(value.Template.Content)
oContent := strings.TrimSpace(other.Template.Content)
if util.IsNumeric(vContent) && util.IsNumeric(oContent) {
v1, _ := strconv.ParseFloat(vContent, 64)
v2, _ := strconv.ParseFloat(oContent, 64)
if v1 > v2 {
return 1
}