fix: address PR review — wire up tier-up embeds, fix logger, clean up tests
- Import notify_tier_completion from helpers.evolution_notifs instead of using the local stub in logic_gameplay.py (WP-14 embeds were dead code) - Add module-level logger to helpers/main.py, replace bare logging.warning() - Remove duplicate @pytest.mark.asyncio decorator in test_card_embed_evolution.py - Fix progress='close' filter to use filtered count in pagination footer Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
9b62118324
commit
eae897ddd6
@ -174,6 +174,7 @@ class Evolution(commands.Cog):
|
||||
# Apply "close" filter client-side
|
||||
if progress and progress.lower() == "close":
|
||||
items = [s for s in items if is_close_to_tierup(s)]
|
||||
total_count = len(items)
|
||||
if not items:
|
||||
await interaction.followup.send(
|
||||
"No cards are close to a tier-up right now.",
|
||||
|
||||
@ -23,6 +23,7 @@ from helpers import (
|
||||
position_name_to_abbrev,
|
||||
team_role,
|
||||
)
|
||||
from helpers.evolution_notifs import notify_tier_completion
|
||||
from in_game.ai_manager import get_starting_lineup
|
||||
from in_game.game_helpers import PUBLIC_FIELDS_CATEGORY_NAME, legal_check
|
||||
from in_game.gameplay_models import (
|
||||
@ -4242,24 +4243,6 @@ async def get_game_summary_embed(
|
||||
return game_embed
|
||||
|
||||
|
||||
async def notify_tier_completion(channel: discord.TextChannel, tier_up: dict) -> None:
|
||||
"""Stub for WP-14: log evolution tier-up events.
|
||||
|
||||
WP-14 will replace this with a full Discord embed notification. For now we
|
||||
only log the event so that the WP-13 hook has a callable target and the
|
||||
tier-up data is visible in the application log.
|
||||
|
||||
Args:
|
||||
channel: The Discord channel where the game was played.
|
||||
tier_up: Dict from the evolution API, expected to contain at minimum
|
||||
'player_id', 'old_tier', and 'new_tier' keys.
|
||||
"""
|
||||
logger.info(
|
||||
f"[WP-14 stub] notify_tier_completion called for channel={channel.id if channel else 'N/A'} "
|
||||
f"tier_up={tier_up}"
|
||||
)
|
||||
|
||||
|
||||
async def complete_game(
|
||||
session: Session,
|
||||
interaction: discord.Interaction,
|
||||
|
||||
@ -2,6 +2,8 @@ import asyncio
|
||||
import datetime
|
||||
import logging
|
||||
import math
|
||||
|
||||
logger = logging.getLogger("discord_app")
|
||||
import os
|
||||
import random
|
||||
import traceback
|
||||
@ -132,7 +134,7 @@ async def get_card_embeds(card, include_stats=False) -> list:
|
||||
tier = evo_state["current_tier"]
|
||||
tier_badge = f"[{'EVO' if tier >= 4 else f'T{tier}'}] "
|
||||
except Exception:
|
||||
logging.warning(
|
||||
logger.warning(
|
||||
f"Could not fetch evolution state for card {card.get('id')}; "
|
||||
"displaying without tier badge.",
|
||||
exc_info=True,
|
||||
|
||||
@ -158,7 +158,6 @@ class TestCardEmbedTierBadge:
|
||||
returns, then call get_card_embeds() and inspect the resulting embed title.
|
||||
"""
|
||||
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.asyncio
|
||||
async def test_no_evolution_state_shows_plain_name(self):
|
||||
"""
|
||||
|
||||
Loading…
Reference in New Issue
Block a user