Skip to content

Commit

Permalink
fix: remove unused column in schedule page
Browse files Browse the repository at this point in the history
  • Loading branch information
acifani committed Nov 29, 2022
1 parent 386f914 commit 74d479d
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions internal/ui/season/season.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import (
)

type model struct {
year string
table table.Model
styles ui.Styles
err error
Expand All @@ -26,7 +27,6 @@ type fetchDone struct {

func New(styles ui.Styles) page.Model {
columns := []table.Column{
{Title: "Year", Width: 0},
{Title: "#", Width: 2},
{Title: "Race", Width: 25},
{Title: "Circuit", Width: 25},
Expand Down Expand Up @@ -57,16 +57,17 @@ func (m model) Update(msg tea.Msg) (page.Model, tea.Cmd) {
switch msg.String() {
case "enter":
row := m.table.SelectedRow()
return m, results.LoadResults(row[0], row[1])
return m, results.LoadResults(m.year, row[0])
case "q":
row := m.table.SelectedRow()
return m, quali.LoadResults(row[0], row[1])
return m, quali.LoadResults(m.year, row[0])
}

case fetchDone:
if msg.err != nil {
m.err = msg.err
} else {
m.year = msg.data.Season
rows := generateRows(msg.data)
m.table.SetHeight(len(rows))
m.table.SetRows(rows)
Expand Down Expand Up @@ -95,7 +96,6 @@ func generateRows(schedule *api.ScheduleTable) []table.Row {
rows := make([]table.Row, len(schedule.Races))
for i, race := range schedule.Races {
rows[i] = table.Row{
schedule.Season,
race.Round,
race.RaceName,
race.Circuit.Location.Locality + ", " + race.Circuit.Location.Country,
Expand Down

0 comments on commit 74d479d

Please sign in to comment.