Skip to content

Commit

Permalink
Don't show teams with 0% chance of winning
Browse files Browse the repository at this point in the history
  • Loading branch information
rcy committed Oct 4, 2023
1 parent 1f7b4f6 commit d9f4db2
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions handlers/mlb/mlb.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,9 @@ type TeamList []Team

func (tl TeamList) String() string {
arr := []string{}
for i, team := range tl {
arr = append(arr, fmt.Sprintf("%s:%.0f%%", team.AbbName, 100*team.EndData.WsWin))
if i == 5 { // top 6 teams make the playoffs in each league
arr = append(arr, "|")
for _, team := range tl {
if team.EndData.WsWin != 0.0 {
arr = append(arr, fmt.Sprintf("%s:%.0f%%", team.AbbName, 100*team.EndData.WsWin))
}
}
return strings.Join(arr, " ")
Expand Down

0 comments on commit d9f4db2

Please sign in to comment.