added map played total

This commit is contained in:
2021-11-14 12:51:39 +01:00
parent 2d8b989d3a
commit 42b5ddf878

View File

@@ -166,6 +166,7 @@ type MetaStatsResponse struct {
WeaponDmg []*WeaponDmg `json:"weapon_dmg,omitempty"`
WinMaps map[string]float32 `json:"win_maps,omitempty"`
TieMaps map[string]float32 `json:"tie_maps,omitempty"`
TotalMaps map[string]int `json:"total_maps,omitempty"`
}
type MatchResponse struct {
@@ -355,6 +356,10 @@ func GetMetaStats(dbPlayer *ent.Player) (*MetaStatsResponse, error) {
mResponse.TieMaps[tMap] = float32(ties) / float32(mapMatchTotal[tMap])
}
for tMap, total := range mapMatchTotal {
mResponse.TotalMaps[tMap] = total
}
// sort all results
sort.Slice(mResponse.BestMates, func(i, j int) bool {
return mResponse.BestMates[i].WinRate > mResponse.BestMates[j].WinRate