fixed match average rank including unranked players
This commit is contained in:
2
main.go
2
main.go
@@ -794,7 +794,7 @@ func getMatch(w http.ResponseWriter, r *http.Request) {
|
|||||||
MatchID uint64 `json:"match_stats"`
|
MatchID uint64 `json:"match_stats"`
|
||||||
}
|
}
|
||||||
|
|
||||||
err = tMatch.QueryStats().GroupBy(matchplayer.MatchesColumn).Aggregate(ent.Mean(matchplayer.FieldRankOld)).Scan(context.Background(), &v)
|
err = tMatch.QueryStats().Where(matchplayer.RankOldNEQ(0)).GroupBy(matchplayer.MatchesColumn).Aggregate(ent.Mean(matchplayer.FieldRankOld)).Scan(context.Background(), &v)
|
||||||
if err != nil || len(v) == 0 {
|
if err != nil || len(v) == 0 {
|
||||||
log.Errorf("[GM] Unable to calc avg rank for match %d: %v", tMatch.ID, err)
|
log.Errorf("[GM] Unable to calc avg rank for match %d: %v", tMatch.ID, err)
|
||||||
w.WriteHeader(http.StatusInternalServerError)
|
w.WriteHeader(http.StatusInternalServerError)
|
||||||
|
Reference in New Issue
Block a user