Skip to content

Commit

Permalink
add neutral GDT to table
Browse files Browse the repository at this point in the history
  • Loading branch information
Fustrate committed Apr 2, 2024
1 parent d30ef28 commit b1b82ad
Showing 1 changed file with 14 additions and 4 deletions.
18 changes: 14 additions & 4 deletions scripts/around_the_horn.rb
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ def ath_games_header = "#{(@subreddit.now - POST_AT).strftime('%A')}'s Games"

def ath_games_table
table(
headers: ['Away', ['Score', :center], 'Home', ['Score', :center], ['Status', :center], 'National'],
headers: ['Away', ['Score', :center], 'Home', ['Score', :center], ['Status', :center], 'National', 'GDT'],
rows: @todays_games.map { todays_games_row(_1) }
)
end
Expand All @@ -52,16 +52,26 @@ def yesterday_link

def todays_games_row(game)
[
game[:away][:link],
team_link(game, :away),
game[:away][:score],
game[:home][:link],
team_link(game, :home),
game[:home][:score],
game[:status],
game[:national] || ' '
game[:national] || ' ',
(game[:neutral][:post_id] ? "[GDT](/#{game[:neutral][:post_id]})" : '')
]
end
end

def team_link(game, flag)
# abbreviation:, subreddit:, post_id:, link:, score:
team = game[flag]

return "[#{team[:abbreviation]}](/#{team[:post_id]} \"team-#{team[:abbreviation].downcase}\")" if team[:post_id]

"[#{team[:abbreviation]}](/r/#{team[:subreddit]})"
end

def initialize
super(purpose: 'Around the Horn', account: 'BaseballBot')

Expand Down

0 comments on commit b1b82ad

Please sign in to comment.