Critical Fixes:
- Fix async context manager usage in fastapi_app.py (async for -> async with)
- Add broadcast() method to WebSocketService
- Initialize BackgroundLoaderService properly in lifespan function
Testing:
- Execute manual testing (Tests 1, 5, 8, 9)
- Create comprehensive test results document
- Verify API endpoints return 202 Accepted
- Confirm database persistence works
- Validate startup incomplete series check
Test Results:
- Response time: 61ms (target: < 500ms) ✅
- 4 series found with missing data on startup
- Database fields properly persisted
- All critical bugs fixed
Files:
- check_db.py: Database inspection utility
- docs/MANUAL_TESTING_RESULTS.md: Comprehensive test results
- src/server/fastapi_app.py: Fixed async context manager, initialized BackgroundLoaderService
- src/server/services/websocket_service.py: Added broadcast() method
36 lines
1.1 KiB
Python
36 lines
1.1 KiB
Python
"""Simple database check script for manual testing."""
|
|
import asyncio
|
|
|
|
from sqlalchemy import select
|
|
|
|
from src.server.database.connection import get_db_session, init_db
|
|
from src.server.database.models import AnimeSeries
|
|
|
|
|
|
async def check_series():
|
|
"""Check series in database."""
|
|
await init_db()
|
|
|
|
async with get_db_session() as session:
|
|
result = await session.execute(select(AnimeSeries))
|
|
series_list = result.scalars().all()
|
|
|
|
print(f'\n=== Database Series Check ===')
|
|
print(f'Total series: {len(series_list)}')
|
|
print()
|
|
|
|
for s in series_list:
|
|
status = getattr(s, 'loading_status', 'no field')
|
|
episodes = getattr(s, 'episodes_loaded', 'N/A')
|
|
nfo = getattr(s, 'nfo_loaded', 'N/A')
|
|
logo = getattr(s, 'logo_loaded', 'N/A')
|
|
images = getattr(s, 'images_loaded', 'N/A')
|
|
|
|
print(f'{s.name} ({s.key}):')
|
|
print(f' Status: {status}')
|
|
print(f' Episodes: {episodes}, NFO: {nfo}, Logo: {logo}, Images: {images}')
|
|
print()
|
|
|
|
if __name__ == '__main__':
|
|
asyncio.run(check_series())
|