-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Steven Hoffman <[email protected]>
- Loading branch information
Showing
5 changed files
with
53 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
# frozen_string_literal: true | ||
|
||
# Copyright (c) Valencia Management Group | ||
# All rights reserved. | ||
|
||
require_relative 'subcommand' | ||
|
||
class Flair < Subcommand | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
# frozen_string_literal: true | ||
|
||
require_relative 'game_thread_loader' | ||
|
||
# /r/baseball is running a game thread for all games this season... for now. | ||
class BaseballGameThreadLoader < GameThreadLoader | ||
SUBREDDIT_ID = 15 | ||
|
||
POST_AT_QUERY = <<~SQL.freeze | ||
SELECT options#>>'{game_threads,post_at}' AS post_at | ||
FROM subreddits | ||
WHERE id = #{SUBREDDIT_ID} | ||
SQL | ||
|
||
def initialize | ||
super(date: Date.new(Date.today.year, Date.today.month, 1)) | ||
end | ||
|
||
def add_game(game) | ||
starts_at = Time.parse(game['gameDate']) + @utc_offset | ||
|
||
insert_game(SUBREDDIT_ID, game, post_at.call(starts_at), starts_at) | ||
end | ||
|
||
def post_at | ||
@post_at ||= Baseballbot::Utility.adjust_time_proc(db.exec(POST_AT_QUERY)[0]['post_at']) | ||
end | ||
end |