dxstats.py now uses is_ham_hf flag on bands list instead of providing its own. Closes #139

This commit is contained in:
Ian Renton
2026-09-02 07:46:02 +01:00
parent 9258d680fc
commit 5a6fc19ab5
9 changed files with 19 additions and 18 deletions
+4 -3
View File
@@ -9,6 +9,7 @@ import tornado
from tornado import httputil
from tornado.web import Application
from core.constants import BANDS
from core.enums import Continent
from core.prometheus_metrics_handler import api_requests_counter
from core.utils import safe_json_dumps
@@ -16,7 +17,7 @@ from core.utils import safe_json_dumps
logger = logging.getLogger(__name__)
CONTINENTS = [c.value for c in Continent]
BANDS = ["160m", "80m", "60m", "40m", "30m", "20m", "17m", "15m", "12m", "10m", "6m"]
HF_BANDS = [b.name for b in BANDS if b.is_ham_hf]
class APIDxStatsHandler(tornado.web.RequestHandler):
@@ -52,11 +53,11 @@ class APIDxStatsHandler(tornado.web.RequestHandler):
continue
if not spot.time or spot.time < one_hour_ago:
continue
if spot.de_continent in CONTINENTS and spot.dx_continent in CONTINENTS and spot.band in BANDS:
if spot.de_continent in CONTINENTS and spot.dx_continent in CONTINENTS and spot.band in HF_BANDS:
counts[spot.de_continent, spot.dx_continent, spot.band] += 1
result = {
de: {dx: {band: counts[de, dx, band] for band in BANDS} for dx in CONTINENTS} for de in CONTINENTS
de: {dx: {band: counts[de, dx, band] for band in HF_BANDS} for dx in CONTINENTS} for de in CONTINENTS
}
self.write(json.dumps(result))