51 lines
1.8 KiB
Python
51 lines
1.8 KiB
Python
import asyncio
|
|
import os
|
|
import sys
|
|
from datetime import datetime
|
|
|
|
# Add backend directory to path
|
|
sys.path.insert(0, os.path.abspath(os.path.join(os.path.dirname(__file__), '..')))
|
|
|
|
from app.database import get_db
|
|
from app.models.db import Position
|
|
from sqlalchemy import select, func
|
|
|
|
async def check_sun_data():
|
|
"""Check data for 2025-12-04 00:00:00"""
|
|
async for session in get_db():
|
|
try:
|
|
target_time = datetime(2025, 12, 4, 0, 0, 0)
|
|
print(f"Checking data for all bodies at {target_time}...")
|
|
|
|
# Get all bodies
|
|
from app.models.db.celestial_body import CelestialBody
|
|
stmt = select(CelestialBody.id, CelestialBody.name, CelestialBody.type).where(CelestialBody.is_active != False)
|
|
result = await session.execute(stmt)
|
|
all_bodies = result.all()
|
|
print(f"Total active bodies: {len(all_bodies)}")
|
|
|
|
# Check positions for each
|
|
missing_bodies = []
|
|
for body_id, body_name, body_type in all_bodies:
|
|
stmt = select(func.count(Position.id)).where(
|
|
Position.body_id == body_id,
|
|
Position.time == target_time
|
|
)
|
|
result = await session.execute(stmt)
|
|
count = result.scalar()
|
|
if count == 0:
|
|
missing_bodies.append(f"{body_name} ({body_id}) [{body_type}]")
|
|
|
|
if missing_bodies:
|
|
print(f"❌ Missing data for {len(missing_bodies)} bodies:")
|
|
for b in missing_bodies:
|
|
print(f" - {b}")
|
|
else:
|
|
print("✅ All active bodies have data for this time!")
|
|
|
|
finally:
|
|
break
|
|
|
|
if __name__ == "__main__":
|
|
asyncio.run(check_sun_data())
|