1
0
mirror of https://github.com/taigrr/wtf synced 2025-01-18 04:03:14 -08:00

fix: resolve PR commits

This commit is contained in:
Cizer Pereira 2019-10-25 08:27:14 +02:00
parent 47941026f2
commit 5261325771

View File

@ -105,16 +105,16 @@ func (widget *Widget) GetStandings(leagueId int) string {
return fmt.Sprintf("Error fetching standings") return fmt.Sprintf("Error fetching standings")
} }
if len(l.Standings) > 0 { if len(l.Standings) == 0 {
return fmt.Sprintf("Error fetching standings")
}
for _, i := range l.Standings[0].Table { for _, i := range l.Standings[0].Table {
if i.Position <= widget.settings.standingCount { if i.Position <= widget.settings.standingCount {
row := []string{strconv.Itoa(i.Position), i.Team.Name, strconv.Itoa(i.PlayedGames), strconv.Itoa(i.Won), strconv.Itoa(i.Draw), strconv.Itoa(i.Lost), strconv.Itoa(i.GoalDifference), strconv.Itoa(i.Points)} row := []string{strconv.Itoa(i.Position), i.Team.Name, strconv.Itoa(i.PlayedGames), strconv.Itoa(i.Won), strconv.Itoa(i.Draw), strconv.Itoa(i.Lost), strconv.Itoa(i.GoalDifference), strconv.Itoa(i.Points)}
tStandings.Append(row) tStandings.Append(row)
} }
} }
} else {
return fmt.Sprintf("Error fetching standings")
}
tStandings.Render() tStandings.Render()
content += buf.String() content += buf.String()
@ -151,7 +151,9 @@ func (widget *Widget) GetMatches(leagueId int) string {
return fmt.Sprintf("Error fetching matches: %s", err.Error()) return fmt.Sprintf("Error fetching matches: %s", err.Error())
} }
if len(l.Matches) != 0 { if len(l.Matches) == 0 {
return fmt.Sprintf("Error fetching matches")
}
for _, m := range l.Matches { for _, m := range l.Matches {
@ -177,7 +179,6 @@ func (widget *Widget) GetMatches(leagueId int) string {
content += "\nUpcoming Matches:\n\n" content += "\nUpcoming Matches:\n\n"
content += scheduledBuf.String() content += scheduledBuf.String()
} }
}
return content return content
} }