Fix linting errors across backend and frontend
Backend: auto-fix and format all ruff issues, manually fix B904/B023/ SIM117/B007/E741/F841 errors, suppress B008 (FastAPI Depends) and F821 (SQLAlchemy forward refs) in config. Frontend: allow constant exports, disable React compiler-specific rules (set-state-in-effect, preserve-manual-memoization). Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -84,8 +84,12 @@ async def get_stats(session: AsyncSession = Depends(get_session)):
|
||||
fainted_count = enc.fainted
|
||||
missed_count = enc.missed
|
||||
|
||||
catch_rate = round(caught_count / total_encounters, 4) if total_encounters > 0 else None
|
||||
avg_encounters_per_run = round(total_encounters / total_runs, 1) if total_runs > 0 else None
|
||||
catch_rate = (
|
||||
round(caught_count / total_encounters, 4) if total_encounters > 0 else None
|
||||
)
|
||||
avg_encounters_per_run = (
|
||||
round(total_encounters / total_runs, 1) if total_runs > 0 else None
|
||||
)
|
||||
|
||||
# --- Top caught pokemon (top 10) ---
|
||||
top_caught_q = await session.execute(
|
||||
@@ -102,7 +106,9 @@ async def get_stats(session: AsyncSession = Depends(get_session)):
|
||||
.limit(10)
|
||||
)
|
||||
top_caught_pokemon = [
|
||||
PokemonRanking(pokemon_id=r.id, name=r.name, sprite_url=r.sprite_url, count=r.count)
|
||||
PokemonRanking(
|
||||
pokemon_id=r.id, name=r.name, sprite_url=r.sprite_url, count=r.count
|
||||
)
|
||||
for r in top_caught_q.all()
|
||||
]
|
||||
|
||||
@@ -120,7 +126,9 @@ async def get_stats(session: AsyncSession = Depends(get_session)):
|
||||
.limit(10)
|
||||
)
|
||||
top_encountered_pokemon = [
|
||||
PokemonRanking(pokemon_id=r.id, name=r.name, sprite_url=r.sprite_url, count=r.count)
|
||||
PokemonRanking(
|
||||
pokemon_id=r.id, name=r.name, sprite_url=r.sprite_url, count=r.count
|
||||
)
|
||||
for r in top_enc_q.all()
|
||||
]
|
||||
|
||||
@@ -149,8 +157,7 @@ async def get_stats(session: AsyncSession = Depends(get_session)):
|
||||
.limit(5)
|
||||
)
|
||||
top_death_causes = [
|
||||
DeathCause(cause=r.death_cause, count=r.count)
|
||||
for r in death_causes_q.all()
|
||||
DeathCause(cause=r.death_cause, count=r.count) for r in death_causes_q.all()
|
||||
]
|
||||
|
||||
# Average levels
|
||||
@@ -179,8 +186,7 @@ async def get_stats(session: AsyncSession = Depends(get_session)):
|
||||
.order_by(func.count().desc())
|
||||
)
|
||||
type_distribution = [
|
||||
TypeCount(type=r.type_name, count=r.count)
|
||||
for r in type_q.all()
|
||||
TypeCount(type=r.type_name, count=r.count) for r in type_q.all()
|
||||
]
|
||||
|
||||
return StatsResponse(
|
||||
|
||||
Reference in New Issue
Block a user