mirror of
https://github.com/pagefaultgames/rogueserver.git
synced 2025-02-22 16:41:28 +08:00
Nil check battle and classic session count
This commit is contained in:
parent
a4014feea8
commit
6a0a130b1d
3
.gitignore
vendored
3
.gitignore
vendored
@ -1,4 +1,5 @@
|
||||
|
||||
pokerogue-server.exe
|
||||
# no extension on linux, .exe on windows
|
||||
pokerogue-server*
|
||||
userdata/*
|
||||
secret.key
|
||||
|
@ -12,7 +12,7 @@ func FetchPlayerCount() (int, error) {
|
||||
|
||||
func FetchBattleCount() (int, error) {
|
||||
var battleCount int
|
||||
err := handle.QueryRow("SELECT SUM(battles) FROM accountStats").Scan(&battleCount)
|
||||
err := handle.QueryRow("SELECT COALESCE(SUM(battles), 0) FROM accountStats").Scan(&battleCount)
|
||||
if err != nil {
|
||||
return 0, err
|
||||
}
|
||||
@ -22,7 +22,7 @@ func FetchBattleCount() (int, error) {
|
||||
|
||||
func FetchClassicSessionCount() (int, error) {
|
||||
var classicSessionCount int
|
||||
err := handle.QueryRow("SELECT SUM(classicSessionsPlayed) FROM accountStats").Scan(&classicSessionCount)
|
||||
err := handle.QueryRow("SELECT COALESCE(SUM(classicSessionsPlayed), 0) FROM accountStats").Scan(&classicSessionCount)
|
||||
if err != nil {
|
||||
return 0, err
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user