Skip to content

Commit

Permalink
refactor!: remove .SeasonSlug attribute
Browse files Browse the repository at this point in the history
BREAKING CHANGE: use slug from your request instead
  • Loading branch information
stnokott committed Sep 12, 2023
1 parent dbd76c8 commit 4e9dabf
Showing 1 changed file with 0 additions and 25 deletions.
25 changes: 0 additions & 25 deletions types/stats/parsed.go
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,6 @@ Summarized stats
// SummarizedStats provides stats without any specific aggregation.
type SummarizedStats struct {
statsLoader[SummarizedGameModeStats, ubiTeamRolesJSON]
SeasonSlug string
}

type SummarizedGameModeStats struct {
Expand Down Expand Up @@ -114,9 +113,6 @@ func (s *SummarizedStats) loadTeamRole(jsn *ubiTeamRolesJSON, stats *SummarizedG
return
}
*outputTeamRoles[i] = newDetailedStats(data)
if s.SeasonSlug == "" {
s.SeasonSlug = assembleSeasonSlug(data.ubiSeasonInfo)
}

if stats.matchStats.MatchesPlayed == 0 {
stats.matchStats = newMatchStats(data)
Expand Down Expand Up @@ -153,7 +149,6 @@ Map stats
// MapStats provides stats aggregated by map.
type MapStats struct {
statsLoader[map[string]NamedMapStatDetails, ubiTeamRolesJSON]
SeasonSlug string
}

type NamedMapStatDetails struct {
Expand Down Expand Up @@ -195,9 +190,6 @@ func (s *MapStats) loadTeamRole(jsn *ubiTeamRolesJSON, stats *map[string]NamedMa
DetailedStats: *newDetailedStats(data),
matchStats: newMatchStats(data),
}
if s.SeasonSlug == "" {
s.SeasonSlug = assembleSeasonSlug(data.ubiSeasonInfo)
}
}
*stats = mapStats

Expand All @@ -211,7 +203,6 @@ Bombsite stats
// BombsiteStats provides stats aggregated by map.
type BombsiteStats struct {
statsLoader[BombsiteGamemodeStats, ubiTeamRolesJSON]
SeasonSlug string
}

type BombsiteGamemodeStats struct {
Expand Down Expand Up @@ -646,21 +637,8 @@ func newTotalDetailedTeamRoleStats(data []ubiTypedTeamRoleJSON) (*DetailedStats,
return v, nil
}

func assembleSeasonSlug(v ubiSeasonInfo) string {
year := "??"
number := "??"
if v.SeasonYear != nil {
year = *v.SeasonYear
}
if v.SeasonNumber != nil {
number = *v.SeasonNumber
}
return year + number
}

type NamedStats struct {
statsLoader[NamedTeamRoles, ubiTeamRolesJSON]
SeasonSlug string
}

type NamedTeamRoleStats map[string]DetailedStats
Expand Down Expand Up @@ -707,9 +685,6 @@ func (s *NamedStats) loadTeamRole(jsn *ubiTeamRolesJSON, stats *NamedTeamRoles)
name = *data.StatsDetail
}
resultTeamRoleData[name] = *newDetailedStats(data)
if s.SeasonSlug == "" {
s.SeasonSlug = assembleSeasonSlug(data.ubiSeasonInfo)
}
}
*resultFields[i] = resultTeamRoleData
}
Expand Down

0 comments on commit 4e9dabf

Please sign in to comment.