54 lines
2.0 KiB
Python
54 lines
2.0 KiB
Python
#!/usr/bin/env python3
|
|
"""Check celestial_type_configs system setting"""
|
|
import asyncio
|
|
import sys
|
|
import os
|
|
import json
|
|
|
|
sys.path.append(os.path.join(os.getcwd(), "backend"))
|
|
|
|
from app.database import AsyncSessionLocal
|
|
from app.services.system_settings_service import system_settings_service
|
|
|
|
async def check_configs():
|
|
async with AsyncSessionLocal() as session:
|
|
# Get celestial_type_configs
|
|
configs = await system_settings_service.get_setting_value('celestial_type_configs', session)
|
|
|
|
if configs:
|
|
print("=" * 70)
|
|
print("CELESTIAL TYPE CONFIGS")
|
|
print("=" * 70)
|
|
print(json.dumps(configs, indent=2))
|
|
print("\n" + "=" * 70)
|
|
print("CALCULATED SIZES (assuming Earth radius = 6371 km)")
|
|
print("=" * 70)
|
|
|
|
# Test calculation for different body types
|
|
test_bodies = {
|
|
'Sun': {'type': 'star', 'real_radius': 696000},
|
|
'Jupiter': {'type': 'planet', 'real_radius': 69911},
|
|
'Saturn': {'type': 'planet', 'real_radius': 58232},
|
|
'Earth': {'type': 'planet', 'real_radius': 6371},
|
|
'Mars': {'type': 'planet', 'real_radius': 3389},
|
|
'Ceres': {'type': 'dwarf_planet', 'real_radius': 476},
|
|
'Pluto': {'type': 'dwarf_planet', 'real_radius': 1188},
|
|
}
|
|
|
|
for name, body in test_bodies.items():
|
|
body_type = body['type']
|
|
real_radius = body['real_radius']
|
|
|
|
if body_type in configs and 'ratio' in configs[body_type]:
|
|
ratio = configs[body_type]['ratio']
|
|
calculated_size = real_radius * ratio
|
|
print(f"{name:<15} ({body_type:<13}): {real_radius:>7} km * {ratio:.6f} = {calculated_size:.4f}")
|
|
else:
|
|
print(f"{name:<15} ({body_type:<13}): No ratio config found")
|
|
|
|
else:
|
|
print("❌ celestial_type_configs not found in system settings")
|
|
|
|
if __name__ == "__main__":
|
|
asyncio.run(check_configs())
|