diff --git a/.github/workflows/update_milb_game_stats_winter.yml b/.github/workflows/update_milb_game_stats_winter.yml index 38b65fa..8d44c79 100644 --- a/.github/workflows/update_milb_game_stats_winter.yml +++ b/.github/workflows/update_milb_game_stats_winter.yml @@ -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 *" diff --git a/.github/workflows/update_milb_pbp_winter.yml b/.github/workflows/update_milb_pbp_winter.yml index 9ebaa09..469f882 100644 --- a/.github/workflows/update_milb_pbp_winter.yml +++ b/.github/workflows/update_milb_pbp_winter.yml @@ -1,4 +1,4 @@ -name: Update MiLB PBP - Rookie Ball +name: Update MiLB PBP - Winter Ball on: schedule: # - cron: "0 9 * 5-9 *" diff --git a/get_milb_player_game_stats.py b/get_milb_player_game_stats.py index 959a2fc..8f9a32b 100644 --- a/get_milb_player_game_stats.py +++ b/get_milb_player_game_stats.py @@ -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: @@ -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":