Поменял теханализ, улучшения по простбам
This commit is contained in:
@@ -723,3 +723,43 @@ class MultiSourcesPlaybackDataAPIView(LoginRequiredMixin, View):
|
||||
})
|
||||
except Exception as e:
|
||||
return JsonResponse({'error': str(e)}, status=500)
|
||||
|
||||
|
||||
|
||||
class SatelliteTranspondersAPIView(LoginRequiredMixin, View):
|
||||
"""API endpoint for getting transponders for a satellite."""
|
||||
|
||||
def get(self, request, satellite_id):
|
||||
from mapsapp.models import Transponders
|
||||
|
||||
try:
|
||||
transponders = Transponders.objects.filter(
|
||||
sat_id=satellite_id
|
||||
).select_related('polarization').order_by('downlink')
|
||||
|
||||
if not transponders.exists():
|
||||
return JsonResponse({
|
||||
'satellite_id': satellite_id,
|
||||
'transponders': [],
|
||||
'count': 0
|
||||
})
|
||||
|
||||
transponders_data = []
|
||||
for t in transponders:
|
||||
transponders_data.append({
|
||||
'id': t.id,
|
||||
'name': t.name or '-',
|
||||
'downlink': float(t.downlink) if t.downlink else 0,
|
||||
'uplink': float(t.uplink) if t.uplink else None,
|
||||
'frequency_range': float(t.frequency_range) if t.frequency_range else 0,
|
||||
'polarization': t.polarization.name if t.polarization else '-',
|
||||
'zone_name': t.zone_name or '-',
|
||||
})
|
||||
|
||||
return JsonResponse({
|
||||
'satellite_id': satellite_id,
|
||||
'transponders': transponders_data,
|
||||
'count': len(transponders_data)
|
||||
})
|
||||
except Exception as e:
|
||||
return JsonResponse({'error': str(e)}, status=500)
|
||||
|
||||
Reference in New Issue
Block a user