Nil check battle and classic session count
parent
a4014feea8
commit
6a0a130b1d
|
@ -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…
Reference in New Issue