Skip to content

Commit

Permalink
Update odds to show probability of winning world series
Browse files Browse the repository at this point in the history
  • Loading branch information
rcy committed Oct 4, 2023
1 parent 5b19e80 commit 1f7b4f6
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions handlers/mlb/mlb.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@ import (
)

type TeamEndData struct {
PoffTitle float64
//PoffTitle float64
WsWin float64
}

type Team struct {
Expand All @@ -27,7 +28,7 @@ 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.PoffTitle))
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, "|")
}
Expand All @@ -52,7 +53,7 @@ func fetchTeams() (TeamList, error) {
}

sort.Slice(teams, func(i, j int) bool {
return teams[i].EndData.PoffTitle > teams[j].EndData.PoffTitle
return teams[i].EndData.WsWin > teams[j].EndData.WsWin
})

return teams, nil
Expand Down

0 comments on commit 1f7b4f6

Please sign in to comment.