diff options
author | alex | 2019-06-28 18:54:32 +0100 |
---|---|---|
committer | alex | 2019-06-28 18:54:32 +0100 |
commit | 62144ce8a1b71cdaeac5bc946d1e735299729b16 (patch) | |
tree | 0cbd8118b743b5b26c351d6c070a3c910a066d72 /wat/db.go | |
parent | 3b9233307acfc32414ec982cca2cf72471ac4d50 (diff) | |
download | watbot-62144ce8a1b71cdaeac5bc946d1e735299729b16.tar.gz watbot-62144ce8a1b71cdaeac5bc946d1e735299729b16.tar.bz2 watbot-62144ce8a1b71cdaeac5bc946d1e735299729b16.zip |
fixes #7
Diffstat (limited to 'wat/db.go')
-rw-r--r-- | wat/db.go | 14 |
1 files changed, 10 insertions, 4 deletions
@@ -111,15 +111,21 @@ func (w *WatDb) Act(player *Player, actionType ActionType) { } func (w *WatDb) Strongest() []Player { + return w.GetTopColumn("anarchy") +} + +func (w *WatDb) GetTopColumn(tipe string) []Player { var user = make([]Player, 10) - w.db.Limit(10).Order("anarchy desc").Find(&user) + w.db.Limit(10).Order(tipe + " desc").Find(&user) return user } +func (w *WatDb) Healthiest() []Player { + return w.GetTopColumn("health") +} + func (w *WatDb) TopLost() []Player { - var user = make([]Player, 10) - w.db.Limit(10).Order("coins_lost desc").Find(&user) - return user + return w.GetTopColumn("coins_lost") } func (w *WatDb) TopTen() []Player { |