Skip to content

Commit

Permalink
fix: Keep scraper sorting stable after toggle (#689)
Browse files Browse the repository at this point in the history
* fix: Keep scraper sorting stable after toggle

* go fmt

Co-authored-by: crwxaj <crwxaj>
  • Loading branch information
crwxaj authored Feb 4, 2022
1 parent 111af51 commit f6c54c0
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion pkg/api/options.go
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,13 @@ func (i ConfigResource) toggleSite(req *restful.Request, resp *restful.Response)
site.Save()

var sites []models.Site
db.Order("name asc").Find(&sites)
switch db.Dialect().GetName() {
case "mysql":
db.Order("name asc").Find(&sites)
case "sqlite3":
db.Order("name COLLATE NOCASE asc").Find(&sites)
}

resp.WriteHeaderAndEntity(http.StatusOK, sites)
}

Expand Down

0 comments on commit f6c54c0

Please sign in to comment.