Skip to content

Commit

Permalink
Hotfix on get_milb_player_game_stats.py to better work with Winter …
Browse files Browse the repository at this point in the history
…League data
  • Loading branch information
armstjc committed Dec 17, 2024
1 parent 7c6f941 commit bc7aa5b
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 4 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/update_milb_game_stats_winter.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Update MiLB Player Game Stats - Rookie Ball
name: Update MiLB Player Game Stats - Winter Ball
on:
schedule:
- cron: "31 15 * 10-12,1-3 *"
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/update_milb_pbp_winter.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Update MiLB PBP - Rookie Ball
name: Update MiLB PBP - Winter Ball
on:
schedule:
# - cron: "0 9 * 5-9 *"
Expand Down
18 changes: 16 additions & 2 deletions get_milb_player_game_stats.py
Original file line number Diff line number Diff line change
Expand Up @@ -691,13 +691,23 @@ def get_month_milb_player_game_stats(
parser.add_argument("--season", type=int, required=False)
parser.add_argument("--level", type=str, required=True)
args = parser.parse_args()
lg_level = args.level

season = args.season

if season is None:
season == now.year

if season == now.year and now.month >= 11:
if (
lg_level == "winter" and
(
now.month > 9 or
now.month < 3
)
):
start_month = now.month - 2
end_month = now.month + 1
elif season == now.year and now.month >= 11:
start_month = now.month - 7
end_month = now.month - 6
elif season == (now.year + 1) and now.month <= 3:
Expand All @@ -717,7 +727,11 @@ def get_month_milb_player_game_stats(
start_month = now.month
end_month = now.month + 1

lg_level = args.level
if start_month < 1:
start_month = 1

if end_month > 13:
end_month = 13

for i in range(start_month, end_month):
if platform.system() == "Windows":
Expand Down

0 comments on commit bc7aa5b

Please sign in to comment.