fixed wrong else position
This commit is contained in:
36
main.go
36
main.go
@@ -744,26 +744,26 @@ func getMatchChat(w http.ResponseWriter, r *http.Request) {
|
|||||||
w.WriteHeader(http.StatusInternalServerError)
|
w.WriteHeader(http.StatusInternalServerError)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
} else {
|
}
|
||||||
tStats, err := db.Messages.Query().Where(messages.HasMatchPlayerWith(matchplayer.HasMatchesWith(match.ID(matchId)))).WithMatchPlayer().All(context.Background())
|
} else {
|
||||||
if err != nil {
|
tStats, err := db.Messages.Query().Where(messages.HasMatchPlayerWith(matchplayer.HasMatchesWith(match.ID(matchId)))).WithMatchPlayer().All(context.Background())
|
||||||
log.Infof("[GMC] match %d not found: %+v", matchId, err)
|
if err != nil {
|
||||||
w.WriteHeader(http.StatusNotFound)
|
log.Infof("[GMC] match %d not found: %+v", matchId, err)
|
||||||
return
|
w.WriteHeader(http.StatusNotFound)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
for _, stat := range tStats {
|
||||||
|
steamid := strconv.FormatUint(stat.Edges.MatchPlayer.PlayerStats, 10)
|
||||||
|
if _, ok := resp[steamid]; !ok {
|
||||||
|
resp[steamid] = make([]*utils.ChatResponse, 0)
|
||||||
}
|
}
|
||||||
|
|
||||||
for _, stat := range tStats {
|
resp[steamid] = append(resp[steamid], &utils.ChatResponse{
|
||||||
steamid := strconv.FormatUint(stat.Edges.MatchPlayer.PlayerStats, 10)
|
Message: stat.Message,
|
||||||
if _, ok := resp[steamid]; !ok {
|
AllChat: stat.AllChat,
|
||||||
resp[steamid] = make([]*utils.ChatResponse, 0)
|
Tick: stat.Tick,
|
||||||
}
|
})
|
||||||
|
|
||||||
resp[steamid] = append(resp[steamid], &utils.ChatResponse{
|
|
||||||
Message: stat.Message,
|
|
||||||
AllChat: stat.AllChat,
|
|
||||||
Tick: stat.Tick,
|
|
||||||
})
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user