first already limits to 1, no need for limit
This commit is contained in:
9
main.go
9
main.go
@@ -111,7 +111,7 @@ func housekeeping() {
|
|||||||
log.Warningf("[HK] last shareCode for player %d does not match player", tPlayer.ID)
|
log.Warningf("[HK] last shareCode for player %d does not match player", tPlayer.ID)
|
||||||
continue
|
continue
|
||||||
default:
|
default:
|
||||||
log.Errorf("[HK] Error while request sharecodes: %v", err)
|
log.Errorf("[HK] Error while requesting sharecodes for %d: %v", tPlayer.ID, err)
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -611,13 +611,6 @@ func getMatch(w http.ResponseWriter, r *http.Request) {
|
|||||||
Dmg: &utils.Damage{
|
Dmg: &utils.Damage{
|
||||||
Team: iStats.DmgTeam,
|
Team: iStats.DmgTeam,
|
||||||
Enemy: iStats.DmgEnemy,
|
Enemy: iStats.DmgEnemy,
|
||||||
UD: &utils.UD{
|
|
||||||
HE: iStats.UdHe,
|
|
||||||
Smoke: iStats.UdSmoke,
|
|
||||||
Flash: iStats.UdFlash,
|
|
||||||
Decoy: iStats.UdDecoy,
|
|
||||||
Flames: iStats.UdFlames,
|
|
||||||
},
|
|
||||||
},
|
},
|
||||||
Color: iStats.Color.String(),
|
Color: iStats.Color.String(),
|
||||||
Crosshair: iStats.Crosshair,
|
Crosshair: iStats.Crosshair,
|
||||||
|
@@ -96,18 +96,9 @@ type Rank struct {
|
|||||||
New int `json:"new,omitempty"`
|
New int `json:"new,omitempty"`
|
||||||
}
|
}
|
||||||
|
|
||||||
type UD struct {
|
|
||||||
HE uint `json:"he,omitempty"`
|
|
||||||
Flames uint `json:"flames,omitempty"`
|
|
||||||
Flash uint `json:"flash,omitempty"`
|
|
||||||
Decoy uint `json:"decoy,omitempty"`
|
|
||||||
Smoke uint `json:"smoke,omitempty"`
|
|
||||||
}
|
|
||||||
|
|
||||||
type Damage struct {
|
type Damage struct {
|
||||||
Enemy uint `json:"enemy,omitempty"`
|
Enemy uint `json:"enemy,omitempty"`
|
||||||
Team uint `json:"team,omitempty"`
|
Team uint `json:"team,omitempty"`
|
||||||
UD *UD `json:"ud,omitempty"`
|
|
||||||
}
|
}
|
||||||
|
|
||||||
type SelfTeamEnemy struct {
|
type SelfTeamEnemy struct {
|
||||||
@@ -258,7 +249,7 @@ func IsAuthCodeValid(player *ent.Player, lock *sync.RWMutex, apiKey string, shar
|
|||||||
var err error
|
var err error
|
||||||
if shareCode == "" {
|
if shareCode == "" {
|
||||||
lock.RLock()
|
lock.RLock()
|
||||||
tMatch, err = player.QueryMatches().Order(ent.Asc(match.FieldDate)).Limit(1).Only(context.Background())
|
tMatch, err = player.QueryMatches().Order(ent.Asc(match.FieldDate)).First(context.Background())
|
||||||
lock.RUnlock()
|
lock.RUnlock()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return false, err
|
return false, err
|
||||||
@@ -280,7 +271,7 @@ func IsAuthCodeValid(player *ent.Player, lock *sync.RWMutex, apiKey string, shar
|
|||||||
|
|
||||||
func GetNewShareCodesForPlayer(player *ent.Player, lock *sync.RWMutex, apiKey string, rl ratelimit.Limiter) ([]string, error) {
|
func GetNewShareCodesForPlayer(player *ent.Player, lock *sync.RWMutex, apiKey string, rl ratelimit.Limiter) ([]string, error) {
|
||||||
lock.RLock()
|
lock.RLock()
|
||||||
tMatch, err := player.QueryMatches().Order(ent.Desc(match.FieldDate)).Limit(1).Only(context.Background())
|
tMatch, err := player.QueryMatches().Order(ent.Desc(match.FieldDate)).First(context.Background())
|
||||||
lock.RUnlock()
|
lock.RUnlock()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
|
Reference in New Issue
Block a user