Add O-counter (#334)

* Add backend support for o-counter

* Add o-counter buttons everywhere

* Put o-counter button right-aligned on tabs

* Add o-counter filter
This commit is contained in:
WithoutPants
2020-02-03 11:17:28 +11:00
committed by GitHub
parent 066295f0c9
commit f87117b0d6
22 changed files with 325 additions and 9 deletions

View File

@@ -95,7 +95,7 @@ func getSort(sort string, direction string, tableName string) string {
const randomSeedPrefix = "random_"
if strings.Contains(sort, "_count") {
if strings.HasSuffix(sort, "_count") {
var relationTableName = strings.Split(sort, "_")[0] // TODO: pluralize?
colName := getColumn(relationTableName, "id")
return " ORDER BY COUNT(distinct " + colName + ") " + direction