chore: change select values case

This commit is contained in:
Noah Hsu 2022-07-27 15:49:18 +08:00
parent 4ba04fa7db
commit e707d6b26e
3 changed files with 4 additions and 4 deletions

View File

@ -45,20 +45,20 @@ func SortFiles(objs []Obj, orderBy, orderDirection string) {
case "name":
{
c := strings.Compare(objs[i].GetName(), objs[j].GetName())
if orderDirection == "DESC" {
if orderDirection == "desc" {
return c >= 0
}
return c <= 0
}
case "size":
{
if orderDirection == "DESC" {
if orderDirection == "desc" {
return objs[i].GetSize() >= objs[j].GetSize()
}
return objs[i].GetSize() <= objs[j].GetSize()
}
case "updated_at":
if orderDirection == "DESC" {
if orderDirection == "desc" {
return objs[i].ModTime().After(objs[j].ModTime())
}
return objs[i].ModTime().Before(objs[j].ModTime())

View File

@ -98,7 +98,7 @@ func getMainItems(config driver.Config) []driver.Item {
}, {
Name: "order_direction",
Type: conf.TypeSelect,
Values: "ASC,DESC",
Values: "asc,desc",
}}...)
}
items = append(items, driver.Item{