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))
+1 -1
View File
@@ -76,7 +76,7 @@
</div>
<script src="/static/js/add-spot.js?v=1788331257"></script>
<script src="/static/js/add-spot.js?v=1788331562"></script>
<script>$(document).ready(function () {
$("#nav-link-add-spot").addClass("active");
}); <!-- highlight active page in nav --></script>
+1 -1
View File
@@ -84,7 +84,7 @@
</div>
<script src="/static/js/alerts.js?v=1788331257"></script>
<script src="/static/js/alerts.js?v=1788331562"></script>
<script>$(document).ready(function () {
$("#nav-link-alerts").addClass("active");
}); <!-- highlight active page in nav --></script>
+2 -2
View File
@@ -76,8 +76,8 @@
</div>
<script src="/static/js/spotsbandsandmap.js?v=1788331257"></script>
<script src="/static/js/bands.js?v=1788331257"></script>
<script src="/static/js/spotsbandsandmap.js?v=1788331562"></script>
<script src="/static/js/bands.js?v=1788331562"></script>
<script>$(document).ready(function () {
$("#nav-link-bands").addClass("active");
}); <!-- highlight active page in nav --></script>
+5 -5
View File
@@ -1,6 +1,6 @@
{% extends "skeleton.html" %}
{% block head_extra %}
<link rel="stylesheet" href="/static/css/style.css?v=1788331257" type="text/css">
<link rel="stylesheet" href="/static/css/style.css?v=1788331562" type="text/css">
<link href="/static/vendor/css/bootstrap-5.3.8.min.css" rel="stylesheet">
<link href="/static/vendor/css/fontawesome-6.7.2.min.css" rel="stylesheet">
<link href="/static/vendor/css/solid-6.7.2.min.css" rel="stylesheet">
@@ -15,10 +15,10 @@
window.fetchEventSource = fetchEventSource;
</script>
<script src="/static/js/utils.js?v=1788331257"></script>
<script src="/static/js/ui-ham.js?v=1788331257"></script>
<script src="/static/js/geo.js?v=1788331257"></script>
<script src="/static/js/common.js?v=1788331257"></script>
<script src="/static/js/utils.js?v=1788331562"></script>
<script src="/static/js/ui-ham.js?v=1788331562"></script>
<script src="/static/js/geo.js?v=1788331562"></script>
<script src="/static/js/common.js?v=1788331562"></script>
{% end %}
{% block body %}
<div class="container">
+1 -1
View File
@@ -284,7 +284,7 @@
</div>
<script src="/static/vendor/js/chart-4.4.9.umd.min.js"></script>
<script src="/static/js/conditions.js?v=1788331257"></script>
<script src="/static/js/conditions.js?v=1788331562"></script>
<script>$(document).ready(function () {
$("#nav-link-conditions").addClass("active");
}); <!-- highlight active page in nav --></script>
+2 -2
View File
@@ -113,8 +113,8 @@
const CARTODB_API_KEY = "{{ web_ui_options.get('cartodb_api_key', '') }}";
</script>
<script src="/static/js/spotsbandsandmap.js?v=1788331257"></script>
<script src="/static/js/map.js?v=1788331257"></script>
<script src="/static/js/spotsbandsandmap.js?v=1788331562"></script>
<script src="/static/js/map.js?v=1788331562"></script>
<script>$(document).ready(function () {
$("#nav-link-map").addClass("active");
}); <!-- highlight active page in nav --></script>
+2 -2
View File
@@ -113,8 +113,8 @@
</div>
<script src="/static/js/spotsbandsandmap.js?v=1788331257"></script>
<script src="/static/js/spots.js?v=1788331257"></script>
<script src="/static/js/spotsbandsandmap.js?v=1788331562"></script>
<script src="/static/js/spots.js?v=1788331562"></script>
<script>$(document).ready(function () {
$("#nav-link-spots").addClass("active");
}); <!-- highlight active page in nav --></script>
+1 -1
View File
@@ -86,7 +86,7 @@
</div>
</div>
<script src="/static/js/status.js?v=1788331257"></script>
<script src="/static/js/status.js?v=1788331562"></script>
<script>
$(document).ready(function () {
$("#nav-link-status").addClass("active");