mirror of https://github.com/velour/catbase.git
Compare commits
No commits in common. "fc18fba2d86def8d3306d262883fa8cc6cd8129f" and "7f183b4f2af726eaa507d739bf6eabfe6ba0e71d" have entirely different histories.
fc18fba2d8
...
7f183b4f2a
|
@ -7,10 +7,10 @@ jobs:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
|
|
||||||
- name: Set up Go 1.13
|
- name: Set up Go 1.12
|
||||||
uses: actions/setup-go@v1
|
uses: actions/setup-go@v1
|
||||||
with:
|
with:
|
||||||
go-version: 1.13.x
|
go-version: 1.12
|
||||||
id: go
|
id: go
|
||||||
|
|
||||||
- name: Check out code into the Go module directory
|
- name: Check out code into the Go module directory
|
||||||
|
|
|
@ -73,11 +73,10 @@ func GetItems(db *sqlx.DB, nick string) ([]Item, error) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func LeaderAll(db *sqlx.DB) ([]Item, error) {
|
func LeaderAll(db *sqlx.DB) ([]Item, error) {
|
||||||
s := `select id,item,nick,count from (select id,item,nick,count,max(abs(count)) from counter group by item having count(nick) > 1 and max(abs(count)) > 1) order by count desc`
|
s := `select id,item,nick,max(count) as count from counter group by item having count(nick) > 1 and max(count) > 1 order by count desc`
|
||||||
var items []Item
|
var items []Item
|
||||||
err := db.Select(&items, s)
|
err := db.Select(&items, s)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Error().Msgf("Error querying leaderboard: %w", err)
|
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
for i := range items {
|
for i := range items {
|
||||||
|
@ -261,7 +260,7 @@ func (p *CounterPlugin) message(c bot.Connector, kind bot.Kind, message msg.Mess
|
||||||
|
|
||||||
its, err := cmd()
|
its, err := cmd()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Error().Err(err).Msg("Error with leaderboard")
|
log.Error().Err(err)
|
||||||
return false
|
return false
|
||||||
} else if len(its) == 0 {
|
} else if len(its) == 0 {
|
||||||
return false
|
return false
|
||||||
|
|
|
@ -4,11 +4,10 @@ package counter
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
|
"github.com/velour/catbase/plugins/cli"
|
||||||
"strings"
|
"strings"
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
"github.com/velour/catbase/plugins/cli"
|
|
||||||
|
|
||||||
"github.com/stretchr/testify/assert"
|
"github.com/stretchr/testify/assert"
|
||||||
"github.com/velour/catbase/bot"
|
"github.com/velour/catbase/bot"
|
||||||
"github.com/velour/catbase/bot/msg"
|
"github.com/velour/catbase/bot/msg"
|
||||||
|
|
Loading…
Reference in New Issue