fixed match average rank including unranked players on /matches

This commit is contained in:
2021-12-05 13:22:59 +01:00
parent c24a9c8757
commit 422b8aee05

View File

@@ -738,7 +738,7 @@ func getMatches(w http.ResponseWriter, r *http.Request) {
MatchID uint64 `json:"match_stats"`
}
err := iMatch.QueryStats().GroupBy(matchplayer.MatchesColumn).Aggregate(ent.Mean(matchplayer.FieldRankOld)).Scan(context.Background(), &v)
err := iMatch.QueryStats().Where(matchplayer.RankOldNEQ(0)).GroupBy(matchplayer.MatchesColumn).Aggregate(ent.Mean(matchplayer.FieldRankOld)).Scan(context.Background(), &v)
if err != nil || len(v) == 0 {
log.Errorf("[GMS] Unable to calc avg rank for match %d: %v", iMatch.ID, err)
w.WriteHeader(http.StatusInternalServerError)