frontend kínlódás
This commit is contained in:
58
backend/test_catalog_only.py
Normal file
58
backend/test_catalog_only.py
Normal file
@@ -0,0 +1,58 @@
|
||||
#!/usr/bin/env python3
|
||||
"""
|
||||
Test catalog filtering directly via AssetService.
|
||||
"""
|
||||
import asyncio
|
||||
import sys
|
||||
sys.path.insert(0, '/app')
|
||||
|
||||
from app.db.session import async_sessionmaker
|
||||
from app.services.asset_service import AssetService
|
||||
|
||||
async def test():
|
||||
async_session = async_sessionmaker()
|
||||
async with async_session() as session:
|
||||
async with session.begin():
|
||||
# Get makes
|
||||
makes = await AssetService.get_makes(session)
|
||||
print(f"Total makes: {len(makes)}")
|
||||
if not makes:
|
||||
print("No makes in database")
|
||||
return
|
||||
test_make = makes[0]
|
||||
print(f"Testing with make: {test_make}")
|
||||
|
||||
# Get all models
|
||||
models_all = await AssetService.get_models(session, test_make)
|
||||
print(f"All models for {test_make}: {len(models_all)}")
|
||||
|
||||
# Get filtered by passenger_car
|
||||
models_car = await AssetService.get_models(session, test_make, 'passenger_car')
|
||||
print(f"Models filtered by 'passenger_car': {len(models_car)}")
|
||||
|
||||
# Get filtered by motorcycle
|
||||
models_moto = await AssetService.get_models(session, test_make, 'motorcycle')
|
||||
print(f"Models filtered by 'motorcycle': {len(models_moto)}")
|
||||
|
||||
# Verify filtering works
|
||||
if models_car and len(models_car) <= len(models_all):
|
||||
print("✅ PASS: Car filter returns subset or equal")
|
||||
else:
|
||||
print("⚠ WARNING: Car filter anomaly")
|
||||
|
||||
# Check if there's any difference
|
||||
if models_car != models_all:
|
||||
print("✅ PASS: Filtering actually changes results")
|
||||
else:
|
||||
print("⚠ WARNING: Filtering returns same results (maybe no vehicle_class data)")
|
||||
|
||||
# Print a few examples
|
||||
if models_all:
|
||||
print(f"Sample models: {models_all[:3]}")
|
||||
if models_car:
|
||||
print(f"Sample car models: {models_car[:3]}")
|
||||
if models_moto:
|
||||
print(f"Sample motorcycle models: {models_moto[:3]}")
|
||||
|
||||
if __name__ == "__main__":
|
||||
asyncio.run(test())
|
||||
Reference in New Issue
Block a user