summaryrefslogtreecommitdiffstats
path: root/wat/db.go
diff options
context:
space:
mode:
Diffstat (limited to 'wat/db.go')
-rw-r--r--wat/db.go14
1 files changed, 10 insertions, 4 deletions
diff --git a/wat/db.go b/wat/db.go
index fb677d8..672d65d 100644
--- a/wat/db.go
+++ b/wat/db.go
@@ -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 {