From c7191bb3438885c3191f1bbad2cc18643b8ffa19 Mon Sep 17 00:00:00 2001 From: Helzoph <50453568+Helzoph@users.noreply.github.com> Date: Thu, 26 Sep 2024 08:55:33 +0800 Subject: [PATCH] chore: Remove unused log statements and remove unused UpdateAccountStats --- cache/account.go | 13 ------------- db/account.go | 3 --- db/game.go | 4 ---- 3 files changed, 20 deletions(-) diff --git a/cache/account.go b/cache/account.go index cf7c6c6..ca4b901 100644 --- a/cache/account.go +++ b/cache/account.go @@ -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 { diff --git a/db/account.go b/db/account.go index b2d85db..c95eb16 100644 --- a/db/account.go +++ b/db/account.go @@ -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 } diff --git a/db/game.go b/db/game.go index c0c3cbc..2fb4292 100644 --- a/db/game.go +++ b/db/game.go @@ -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 {