mirror of
https://git.ianrenton.com/ian/spothole.git
synced 2026-09-20 14:27:42 +00:00
Fix a potential NPE and a case where callsign location source could be reported as None instead of DXCC.
This commit is contained in:
@@ -71,7 +71,6 @@ class ModeSource(str, Enum):
|
|||||||
SPOT = "SPOT"
|
SPOT = "SPOT"
|
||||||
COMMENT = "COMMENT"
|
COMMENT = "COMMENT"
|
||||||
BANDPLAN = "BANDPLAN"
|
BANDPLAN = "BANDPLAN"
|
||||||
NONE = "NONE"
|
|
||||||
|
|
||||||
|
|
||||||
class LocationSourceForSpot(str, Enum):
|
class LocationSourceForSpot(str, Enum):
|
||||||
@@ -82,7 +81,6 @@ class LocationSourceForSpot(str, Enum):
|
|||||||
GRID = "GRID"
|
GRID = "GRID"
|
||||||
HOME_QTH = "HOME QTH"
|
HOME_QTH = "HOME QTH"
|
||||||
DXCC = "DXCC"
|
DXCC = "DXCC"
|
||||||
NONE = "NONE"
|
|
||||||
|
|
||||||
|
|
||||||
class LocationSourceForCallsign(str, Enum):
|
class LocationSourceForCallsign(str, Enum):
|
||||||
@@ -90,7 +88,6 @@ class LocationSourceForCallsign(str, Enum):
|
|||||||
|
|
||||||
HOME_QTH = "HOME QTH"
|
HOME_QTH = "HOME QTH"
|
||||||
DXCC = "DXCC"
|
DXCC = "DXCC"
|
||||||
NONE = "NONE"
|
|
||||||
|
|
||||||
|
|
||||||
class SIGRefType(str, Enum):
|
class SIGRefType(str, Enum):
|
||||||
|
|||||||
@@ -43,8 +43,9 @@ def get_sig_ref_info(sig_name, ref_id):
|
|||||||
# database.
|
# database.
|
||||||
if sig_name.upper() == "DME":
|
if sig_name.upper() == "DME":
|
||||||
match = re.match(r"DME[\- ](\d{3,5})", ref_id, re.IGNORECASE)
|
match = re.match(r"DME[\- ](\d{3,5})", ref_id, re.IGNORECASE)
|
||||||
number = match.group(1)
|
if match:
|
||||||
ref_id = f"DME-{number.zfill(5)}"
|
number = match.group(1)
|
||||||
|
ref_id = f"DME-{number.zfill(5)}"
|
||||||
|
|
||||||
# DTMBA spotters sometimes include spaces and dashes, our regex allows them but they must be removed here so we
|
# DTMBA spotters sometimes include spaces and dashes, our regex allows them but they must be removed here so we
|
||||||
# can look up against the official list which doesn't have them
|
# can look up against the official list which doesn't have them
|
||||||
|
|||||||
+1
-1
@@ -38,7 +38,7 @@ class Callsign:
|
|||||||
# ITU zone in which the callsign indicates they are operating
|
# ITU zone in which the callsign indicates they are operating
|
||||||
itu_zone: int | None = None
|
itu_zone: int | None = None
|
||||||
# Location source
|
# Location source
|
||||||
location_source: LocationSourceForCallsign = LocationSourceForCallsign.NONE
|
location_source: LocationSourceForCallsign | None = None
|
||||||
|
|
||||||
def fully_populated(self):
|
def fully_populated(self):
|
||||||
"""Utility method to indicate that the callsign data is fully populated. Multiple providers can return data for
|
"""Utility method to indicate that the callsign data is fully populated. Multiple providers can return data for
|
||||||
|
|||||||
+2
-2
@@ -70,7 +70,7 @@ class Spot:
|
|||||||
dx_latitude: float | None = None
|
dx_latitude: float | None = None
|
||||||
dx_longitude: float | None = None
|
dx_longitude: float | None = None
|
||||||
# DX Location source. Indicates how accurate the location might be.
|
# DX Location source. Indicates how accurate the location might be.
|
||||||
dx_location_source: LocationSourceForSpot = LocationSourceForSpot.NONE
|
dx_location_source: LocationSourceForSpot | None = None
|
||||||
# DX Location good. Indicates that the software thinks the location data is good enough to plot on a map. This is
|
# DX Location good. Indicates that the software thinks the location data is good enough to plot on a map. This is
|
||||||
# true if the location source is "SPOT", "SIG REF LOOKUP" or "GRID", or if the location source is "HOME QTH" and the
|
# true if the location source is "SPOT", "SIG REF LOOKUP" or "GRID", or if the location source is "HOME QTH" and the
|
||||||
# DX callsign doesn't have a suffix like /P.
|
# DX callsign doesn't have a suffix like /P.
|
||||||
@@ -107,7 +107,7 @@ class Spot:
|
|||||||
# Inferred mode "family".
|
# Inferred mode "family".
|
||||||
mode_type: ModeType | None = None
|
mode_type: ModeType | None = None
|
||||||
# Source of the mode information.
|
# Source of the mode information.
|
||||||
mode_source: ModeSource = ModeSource.NONE
|
mode_source: ModeSource | None = None
|
||||||
# Frequency, in Hz
|
# Frequency, in Hz
|
||||||
freq: float | None = None
|
freq: float | None = None
|
||||||
# Band, defined by the frequency, e.g. "40m" or "70cm"
|
# Band, defined by the frequency, e.g. "40m" or "70cm"
|
||||||
|
|||||||
@@ -77,7 +77,7 @@
|
|||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<script src="/static/js/add-spot.js?v=1789059482"></script>
|
<script src="/static/js/add-spot.js?v=1789108335"></script>
|
||||||
<script>$(document).ready(function () {
|
<script>$(document).ready(function () {
|
||||||
$("#nav-link-add-spot").addClass("active");
|
$("#nav-link-add-spot").addClass("active");
|
||||||
}); <!-- highlight active page in nav --></script>
|
}); <!-- highlight active page in nav --></script>
|
||||||
|
|||||||
@@ -83,7 +83,7 @@
|
|||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<script src="/static/js/alerts.js?v=1789059482"></script>
|
<script src="/static/js/alerts.js?v=1789108335"></script>
|
||||||
<script>$(document).ready(function () {
|
<script>$(document).ready(function () {
|
||||||
$("#nav-link-alerts").addClass("active");
|
$("#nav-link-alerts").addClass("active");
|
||||||
}); <!-- highlight active page in nav --></script>
|
}); <!-- highlight active page in nav --></script>
|
||||||
|
|||||||
@@ -76,8 +76,8 @@
|
|||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<script src="/static/js/spotsbandsandmap.js?v=1789059482"></script>
|
<script src="/static/js/spotsbandsandmap.js?v=1789108335"></script>
|
||||||
<script src="/static/js/bands.js?v=1789059482"></script>
|
<script src="/static/js/bands.js?v=1789108335"></script>
|
||||||
<script>$(document).ready(function () {
|
<script>$(document).ready(function () {
|
||||||
$("#nav-link-bands").addClass("active");
|
$("#nav-link-bands").addClass("active");
|
||||||
}); <!-- highlight active page in nav --></script>
|
}); <!-- highlight active page in nav --></script>
|
||||||
|
|||||||
+5
-5
@@ -1,6 +1,6 @@
|
|||||||
{% extends "skeleton.html" %}
|
{% extends "skeleton.html" %}
|
||||||
{% block head_extra %}
|
{% block head_extra %}
|
||||||
<link rel="stylesheet" href="/static/css/style.css?v=1789059482" type="text/css">
|
<link rel="stylesheet" href="/static/css/style.css?v=1789108335" type="text/css">
|
||||||
<link href="/static/vendor/css/bootstrap-5.3.8.min.css" rel="stylesheet">
|
<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/fontawesome-6.7.2.min.css" rel="stylesheet">
|
||||||
<link href="/static/vendor/css/solid-6.7.2.min.css" rel="stylesheet">
|
<link href="/static/vendor/css/solid-6.7.2.min.css" rel="stylesheet">
|
||||||
@@ -16,10 +16,10 @@
|
|||||||
window.fetchEventSource = fetchEventSource;
|
window.fetchEventSource = fetchEventSource;
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<script src="/static/js/utils.js?v=1789059482"></script>
|
<script src="/static/js/utils.js?v=1789108335"></script>
|
||||||
<script src="/static/js/ui-ham.js?v=1789059482"></script>
|
<script src="/static/js/ui-ham.js?v=1789108335"></script>
|
||||||
<script src="/static/js/geo.js?v=1789059482"></script>
|
<script src="/static/js/geo.js?v=1789108335"></script>
|
||||||
<script src="/static/js/common.js?v=1789059482"></script>
|
<script src="/static/js/common.js?v=1789108335"></script>
|
||||||
{% end %}
|
{% end %}
|
||||||
{% block body %}
|
{% block body %}
|
||||||
<div class="container">
|
<div class="container">
|
||||||
|
|||||||
@@ -284,7 +284,7 @@
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<script src="/static/vendor/js/chart-4.4.9.umd.min.js"></script>
|
<script src="/static/vendor/js/chart-4.4.9.umd.min.js"></script>
|
||||||
<script src="/static/js/conditions.js?v=1789059482"></script>
|
<script src="/static/js/conditions.js?v=1789108335"></script>
|
||||||
<script>$(document).ready(function () {
|
<script>$(document).ready(function () {
|
||||||
$("#nav-link-conditions").addClass("active");
|
$("#nav-link-conditions").addClass("active");
|
||||||
}); <!-- highlight active page in nav --></script>
|
}); <!-- highlight active page in nav --></script>
|
||||||
|
|||||||
+2
-2
@@ -113,8 +113,8 @@
|
|||||||
const CARTODB_API_KEY = "{{ web_ui_options.get('cartodb_api_key', '') }}";
|
const CARTODB_API_KEY = "{{ web_ui_options.get('cartodb_api_key', '') }}";
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<script src="/static/js/spotsbandsandmap.js?v=1789059482"></script>
|
<script src="/static/js/spotsbandsandmap.js?v=1789108335"></script>
|
||||||
<script src="/static/js/map.js?v=1789059482"></script>
|
<script src="/static/js/map.js?v=1789108335"></script>
|
||||||
<script>$(document).ready(function () {
|
<script>$(document).ready(function () {
|
||||||
$("#nav-link-map").addClass("active");
|
$("#nav-link-map").addClass("active");
|
||||||
}); <!-- highlight active page in nav --></script>
|
}); <!-- highlight active page in nav --></script>
|
||||||
|
|||||||
@@ -113,8 +113,8 @@
|
|||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<script src="/static/js/spotsbandsandmap.js?v=1789059482"></script>
|
<script src="/static/js/spotsbandsandmap.js?v=1789108335"></script>
|
||||||
<script src="/static/js/spots.js?v=1789059482"></script>
|
<script src="/static/js/spots.js?v=1789108335"></script>
|
||||||
<script>$(document).ready(function () {
|
<script>$(document).ready(function () {
|
||||||
$("#nav-link-spots").addClass("active");
|
$("#nav-link-spots").addClass("active");
|
||||||
}); <!-- highlight active page in nav --></script>
|
}); <!-- highlight active page in nav --></script>
|
||||||
|
|||||||
@@ -86,7 +86,7 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<script src="/static/js/status.js?v=1789059482"></script>
|
<script src="/static/js/status.js?v=1789108335"></script>
|
||||||
<script>
|
<script>
|
||||||
$(document).ready(function () {
|
$(document).ready(function () {
|
||||||
$("#nav-link-status").addClass("active");
|
$("#nav-link-status").addClass("active");
|
||||||
|
|||||||
Reference in New Issue
Block a user