hack our way around the django cache
Signed-off-by: Corey Shields cshields@gmail.com
In django cache we are storing a full queryset of the satellites with their data count and last payload time. By trying to filter on this (sat_cache = sats_cache.filter(norad_cat_id=norad)) we cause django to re-evaluate the queries for that specific satellite. For CAS-4a this results in 2 queries that exceed 5 mins each.
This does not impact the /stats/ page as it iterates through the whole list of satellites in cache. This change mimics that behavior to find the satellite cache we care about in the template. Its a huge hack but its the only way we can show a count and bring the page view back for !237 (merged) quickly... This needs refactoring, big time..
I also pulled an unused has_telemetry_data which caused a db count
This leaves behind a query to pull the last payload to show who submitted the last payload, as without this query there is no connection between the cached satellite info and the actual observer (because the /stats/ page was not meant to make that connection). If this query continues to be prohibitive we may just need to remove the "last frame submitted by.." blob.