From ec5885bdb82485f10934eb4e7d168124dc45a803 Mon Sep 17 00:00:00 2001 From: "Fabian P. Schmidt" Date: Thu, 13 Dec 2018 13:02:24 +0100 Subject: [PATCH] Skip temporary NORAD IDs when fetching TLEs Celestrak started to return the TLE of 00005 when asked for NORAD IDs above 90000. Thus wrong TLEs were assigned to satellites with temporary NORAD IDs and manual_tle=False. This commit prevents satnogs to leak temporary NORAD IDs to Celestrak by skipping them during TLE updates. The threshold of 80000 is a motivated by the following - NORAD ID 80k-90k are used for "Analyst Objects", which aren't necessarily hardlinked to an object [1] - NORAD ID 90k+ don't seem to be assigned at the moment [2] [1]: https://www.space-track.org/documentation#faq [2]: https://celestrak.com/NORAD/elements/master.php --- network/base/tasks.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/network/base/tasks.py b/network/base/tasks.py index a9ff9ec..69e7deb 100644 --- a/network/base/tasks.py +++ b/network/base/tasks.py @@ -20,7 +20,11 @@ from network.celery import app @app.task(ignore_result=True) def update_all_tle(): """Task to update all satellite TLEs""" - satellites = Satellite.objects.exclude(manual_tle=True, norad_follow_id__isnull=True) + satellites = Satellite.objects.exclude(manual_tle=True, + norad_follow_id__isnull=True) + + # Skip satellites with temporary NORAD IDs + satellites = satellites.exclude(norad_cat_id__gte=80000) for obj in satellites: norad_id = obj.norad_cat_id