CLAUDE: Fix /voice-channel private to fetch current week games instead of week 1
The command was incorrectly using get_team_schedule(weeks=1) which fetches the first week of the season rather than the current week's games. Changed to use get_week_schedule(current_week) with proper team filtering. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
parent
36ecd1b3ff
commit
20b79fc8ff
@ -224,12 +224,17 @@ class VoiceChannelCommands(commands.Cog):
|
|||||||
|
|
||||||
# Find opponent from current week's schedule
|
# Find opponent from current week's schedule
|
||||||
try:
|
try:
|
||||||
team_games = await self.schedule_service.get_team_schedule(
|
# Get all games for the current week
|
||||||
current_season, user_team.abbrev, weeks=1
|
week_games = await self.schedule_service.get_week_schedule(current_season, current_week)
|
||||||
)
|
|
||||||
|
|
||||||
current_week_games = [g for g in team_games
|
# Filter for games involving this team that haven't been completed
|
||||||
if g.week == current_week and not g.is_completed]
|
team_abbrev_upper = user_team.abbrev.upper()
|
||||||
|
current_week_games = [
|
||||||
|
g for g in week_games
|
||||||
|
if (g.away_team.abbrev.upper() == team_abbrev_upper or
|
||||||
|
g.home_team.abbrev.upper() == team_abbrev_upper)
|
||||||
|
and not g.is_completed
|
||||||
|
]
|
||||||
|
|
||||||
if not current_week_games:
|
if not current_week_games:
|
||||||
embed = EmbedTemplate.warning(
|
embed = EmbedTemplate.warning(
|
||||||
|
|||||||
@ -458,12 +458,13 @@ class TestVoiceChannelCommands:
|
|||||||
|
|
||||||
with patch('commands.voice.channels.team_service') as mock_team_service:
|
with patch('commands.voice.channels.team_service') as mock_team_service:
|
||||||
with patch('commands.voice.channels.league_service') as mock_league_service:
|
with patch('commands.voice.channels.league_service') as mock_league_service:
|
||||||
with patch.object(voice_cog.schedule_service, 'get_team_schedule') as mock_schedule:
|
with patch.object(voice_cog.schedule_service, 'get_week_schedule') as mock_schedule:
|
||||||
with patch.object(mock_interaction.guild, 'create_voice_channel', return_value=mock_channel) as mock_create:
|
with patch.object(mock_interaction.guild, 'create_voice_channel', return_value=mock_channel) as mock_create:
|
||||||
with patch('discord.utils.get') as mock_utils_get:
|
with patch('discord.utils.get') as mock_utils_get:
|
||||||
|
|
||||||
mock_team_service.get_teams_by_owner = AsyncMock(return_value=[mock_user_team])
|
mock_team_service.get_teams_by_owner = AsyncMock(return_value=[mock_user_team])
|
||||||
mock_league_service.get_current_state = AsyncMock(return_value=mock_current)
|
mock_league_service.get_current_state = AsyncMock(return_value=mock_current)
|
||||||
|
# get_week_schedule returns all games for the week (not just team games)
|
||||||
mock_schedule.return_value = [mock_game]
|
mock_schedule.return_value = [mock_game]
|
||||||
|
|
||||||
# Mock discord.utils.get calls
|
# Mock discord.utils.get calls
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user