From 786e947e092d9f070967babbb388c8f0f0872bd3 Mon Sep 17 00:00:00 2001 From: maru Date: Tue, 30 Apr 2024 00:32:55 -0400 Subject: [PATCH] Change 'banned' to 'limited --- api/savedata/clear.go | 2 +- api/savedata/update.go | 2 +- db/account.go | 4 ++-- db/daily.go | 4 ++-- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/api/savedata/clear.go b/api/savedata/clear.go index dfbfcae..2940c57 100644 --- a/api/savedata/clear.go +++ b/api/savedata/clear.go @@ -54,7 +54,7 @@ func Clear(uuid []byte, slot int, seed string, save defs.SessionSaveData) (Clear } if save.Score >= 20000 { - db.UpdateAccountBanned(uuid, true) + db.SetAccountLimited(uuid, true) } err = db.AddOrUpdateAccountDailyRun(uuid, save.Score, waveCompleted) diff --git a/api/savedata/update.go b/api/savedata/update.go index a5bc89a..db5150a 100644 --- a/api/savedata/update.go +++ b/api/savedata/update.go @@ -60,7 +60,7 @@ func Update(uuid []byte, slot int, save any) error { save.VoucherCounts["1"] > 150 || save.VoucherCounts["2"] > 100 || save.VoucherCounts["3"] > 10 { - db.UpdateAccountBanned(uuid, true) + db.SetAccountLimited(uuid, true) } err = db.UpdateAccountStats(uuid, save.GameStats, save.VoucherCounts) diff --git a/db/account.go b/db/account.go index 50b2c6e..b30e79b 100644 --- a/db/account.go +++ b/db/account.go @@ -144,8 +144,8 @@ func UpdateAccountStats(uuid []byte, stats defs.GameStats, voucherCounts map[str return nil } -func UpdateAccountBanned(uuid []byte, banned bool) error { - _, err := handle.Exec("UPDATE accounts SET banned = ? WHERE uuid = ?", banned, uuid) +func SetAccountLimited(uuid []byte, limited bool) error { + _, err := handle.Exec("UPDATE accounts SET limited = ? WHERE uuid = ?", limited, uuid) if err != nil { return err } diff --git a/db/daily.go b/db/daily.go index 55eb04e..d92222a 100644 --- a/db/daily.go +++ b/db/daily.go @@ -49,9 +49,9 @@ func FetchRankings(category int, page int) ([]defs.DailyRanking, error) { var query string switch category { case 0: - query = "SELECT RANK() OVER (ORDER BY adr.score DESC, adr.timestamp), a.username, adr.score, adr.wave FROM accountDailyRuns adr JOIN dailyRuns dr ON dr.date = adr.date JOIN accounts a ON adr.uuid = a.uuid WHERE dr.date = UTC_DATE() AND a.banned = 0 LIMIT 10 OFFSET ?" + query = "SELECT RANK() OVER (ORDER BY adr.score DESC, adr.timestamp), a.username, adr.score, adr.wave FROM accountDailyRuns adr JOIN dailyRuns dr ON dr.date = adr.date JOIN accounts a ON adr.uuid = a.uuid WHERE dr.date = UTC_DATE() AND a.limited = 0 LIMIT 10 OFFSET ?" case 1: - query = "SELECT RANK() OVER (ORDER BY SUM(adr.score) DESC, adr.timestamp), a.username, SUM(adr.score), 0 FROM accountDailyRuns adr JOIN dailyRuns dr ON dr.date = adr.date JOIN accounts a ON adr.uuid = a.uuid WHERE dr.date >= DATE_SUB(DATE(UTC_TIMESTAMP()), INTERVAL DAYOFWEEK(UTC_TIMESTAMP()) - 1 DAY) AND a.banned = 0 GROUP BY a.username ORDER BY 1 LIMIT 10 OFFSET ?" + query = "SELECT RANK() OVER (ORDER BY SUM(adr.score) DESC, adr.timestamp), a.username, SUM(adr.score), 0 FROM accountDailyRuns adr JOIN dailyRuns dr ON dr.date = adr.date JOIN accounts a ON adr.uuid = a.uuid WHERE dr.date >= DATE_SUB(DATE(UTC_TIMESTAMP()), INTERVAL DAYOFWEEK(UTC_TIMESTAMP()) - 1 DAY) AND a.limited = 0 GROUP BY a.username ORDER BY 1 LIMIT 10 OFFSET ?" } results, err := handle.Query(query, offset)