fixed scan not being used correctly
This commit is contained in:
@@ -100,7 +100,7 @@ func SendJSON(data interface{}, w http.ResponseWriter) error {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func GetMatchStats(db *ent.Client, lock *sync.RWMutex, player *ent.Player) (int, int, int, error) {
|
func GetMatchStats(db *ent.Client, lock *sync.RWMutex, player *ent.Player) (int, int, int, error) {
|
||||||
var v struct {
|
var v []struct {
|
||||||
Wins int `json:"wins"`
|
Wins int `json:"wins"`
|
||||||
Ties int `json:"ties"`
|
Ties int `json:"ties"`
|
||||||
Total int `json:"total"`
|
Total int `json:"total"`
|
||||||
@@ -140,7 +140,11 @@ func GetMatchStats(db *ent.Client, lock *sync.RWMutex, player *ent.Player) (int,
|
|||||||
return 0, 0, 0, err
|
return 0, 0, 0, err
|
||||||
}
|
}
|
||||||
|
|
||||||
return v.Wins, v.Ties, v.Total - v.Wins - v.Ties, nil
|
if len(v) < 1 {
|
||||||
|
return 0, 0, 0, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
return v[0].Wins, v[0].Ties, v[0].Total - v[0].Wins - v[0].Ties, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func IsAuthCodeValid(player *ent.Player, lock *sync.RWMutex, apiKey string, shareCode string, authCode string, rl ratelimit.Limiter) (bool, error) {
|
func IsAuthCodeValid(player *ent.Player, lock *sync.RWMutex, apiKey string, shareCode string, authCode string, rl ratelimit.Limiter) (bool, error) {
|
||||||
|
Reference in New Issue
Block a user