chore: Remove unused log statements and remove unused UpdateAccountStats

pull/53/head
Helzoph 2 months ago
parent ce54f57f53
commit c7191bb343

13
cache/account.go vendored

@ -19,7 +19,6 @@ package cache
import (
"fmt"
"log"
"time"
)
@ -49,19 +48,7 @@ func UpdateAccountLastActivity(uuid []byte) bool {
return err == nil
}
// FIXME
func UpdateAccountStats(uuid []byte, battles, classicSessionsPlayed int) bool {
key := fmt.Sprintf("account:%s", uuid)
err := rdb.HIncrBy(key, "battles", int64(battles)).Err()
if err != nil {
return false
}
err = rdb.HIncrBy(key, "classicSessionsPlayed", int64(classicSessionsPlayed)).Err()
return err == nil
}
func FetchTrainerIds(uuid []byte) (int, int, bool) {
log.Println("FetchTrainerIds", uuid)
key := fmt.Sprintf("account:%s", uuid)
vals, err := rdb.HMGet(key, "trainerId", "secretId").Result()
if err == nil && len(vals) == 2 && vals[0] != nil && vals[1] != nil {

@ -266,9 +266,6 @@ func UpdateAccountStats(uuid []byte, stats defs.GameStats, voucherCounts map[str
return err
}
// TODO: Update cache battle count and classic session count
cache.UpdateAccountStats(uuid, int(statValues[1].(float64)), int(statValues[2].(float64)))
return nil
}

@ -36,10 +36,6 @@ func FetchPlayerCount() (int, error) {
}
func FetchBattleCount() (int, error) {
// if cachedBattleCount, ok := cache.FetchBattleCount(); ok {
// return cachedBattleCount, nil
// }
var battleCount int
err := handle.QueryRow("SELECT COALESCE(SUM(s.battles), 0) FROM accountStats s JOIN accounts a ON a.uuid = s.uuid WHERE a.banned = 0").Scan(&battleCount)
if err != nil {

Loading…
Cancel
Save