diff --git a/core/enums.py b/core/enums.py index 17b4016..75594cb 100644 --- a/core/enums.py +++ b/core/enums.py @@ -48,12 +48,15 @@ class Mode(str, Enum): def from_name(name): """Convert a string to an enum mode using the alias table.""" + if not name: + return Mode.UNKNOWN + try: return Mode(name.upper()) - except ValueError: + except (KeyError, ValueError): try: return Mode(MODE_ALIASES[name.upper()]) - except ValueError: + except (KeyError, ValueError): return Mode.UNKNOWN diff --git a/core/utils.py b/core/utils.py index 204b251..c76930f 100644 --- a/core/utils.py +++ b/core/utils.py @@ -42,6 +42,9 @@ def infer_mode_type_from_mode(mode: str) -> ModeType: if not mode: return ModeType.UNKNOWN + if mode in MODE_ALIASES: + mode = MODE_ALIASES[mode] + try: mode = Mode(mode.upper()) if mode.is_cw: @@ -118,7 +121,7 @@ def get_callsign_object_from_pyhamtools_callinfo(callsign, callinfo): country = data.get("country", None) dxcc_id = data.get("adif", None) - continent = Continent(data.get("continent", None)) + continent = Continent(data["continent"]) if "continent" in data else None cq_zone = data.get("cqz", None) itu_zone = data.get("ituz", None) lat = float(data["latitude"]) if "latitude" in data else None diff --git a/data/alert.py b/data/alert.py index ecdb0b0..a4e923e 100644 --- a/data/alert.py +++ b/data/alert.py @@ -92,8 +92,8 @@ class Alert: call_info = get_call_info(self.dx_calls[0], credentials) if self.dx_calls and self.dx_calls[0] and not self.dx_country: self.dx_country = call_info.country - if self.dx_calls and self.dx_calls[0] and not self.dx_continent: - self.dx_continent = Continent(call_info.continent) if call_info.continent else None + if self.dx_calls and self.dx_calls[0] and call_info.continent and not self.dx_continent: + self.dx_continent = Continent(call_info.continent) if self.dx_calls and self.dx_calls[0] and not self.dx_cq_zone: self.dx_cq_zone = call_info.cq_zone if self.dx_calls and self.dx_calls[0] and not self.dx_itu_zone: diff --git a/data/spot.py b/data/spot.py index 173c556..f52c26a 100644 --- a/data/spot.py +++ b/data/spot.py @@ -184,7 +184,7 @@ class Spot: dx_call_info = get_call_info(self.dx_call, credentials) if self.dx_call and not self.dx_country: self.dx_country = dx_call_info.country - if self.dx_call and not self.dx_continent: + if self.dx_call and dx_call_info.continent and not self.dx_continent: self.dx_continent = Continent(dx_call_info.continent) if self.dx_call and not self.dx_dxcc_id: self.dx_dxcc_id = dx_call_info.dxcc_id @@ -222,7 +222,7 @@ class Spot: ): if not self.de_country: self.de_country = de_call_info.country - if not self.de_continent: + if de_call_info.continent and not self.de_continent: self.de_continent = Continent(de_call_info.continent) if not self.de_dxcc_id: self.de_dxcc_id = de_call_info.dxcc_id diff --git a/providers/alert/parksnpeaks.py b/providers/alert/parksnpeaks.py index 1b8d335..1323470 100644 --- a/providers/alert/parksnpeaks.py +++ b/providers/alert/parksnpeaks.py @@ -59,6 +59,7 @@ class ParksNPeaks(HTTPAlertProvider): "POTA", "SOTA", "WWFF", + "HEMA", "SIOTA", "ZLOTA", "KRMNPA", diff --git a/providers/callsigndata/hamqth.py b/providers/callsigndata/hamqth.py index 77ccd9e..bfe567e 100644 --- a/providers/callsigndata/hamqth.py +++ b/providers/callsigndata/hamqth.py @@ -143,7 +143,7 @@ class HamQTH(APIQueryCallsignDataProvider): name=data.get("nick", None), qth=data.get("qth", None), country=data.get("country", None), - continent=Continent(data.get("continent", None)), + continent=Continent(data["continent"]) if "continent" in data else None, latitude=lat, longitude=lon, grid=grid, diff --git a/providers/callsigndata/qrz.py b/providers/callsigndata/qrz.py index c413bed..4ed570c 100644 --- a/providers/callsigndata/qrz.py +++ b/providers/callsigndata/qrz.py @@ -169,7 +169,7 @@ class QRZ(APIQueryCallsignDataProvider): name=name, qth=data.get("addr2", None), country=data.get("country", None), - continent=Continent(data.get("continent", None)), + continent=Continent(data["continent"]) if "continent" in data else None, latitude=lat, longitude=lon, grid=grid, diff --git a/templates/add_spot.html b/templates/add_spot.html index 18bd382..4d1384d 100644 --- a/templates/add_spot.html +++ b/templates/add_spot.html @@ -77,7 +77,7 @@ - + diff --git a/templates/alerts.html b/templates/alerts.html index e9fed46..f452526 100644 --- a/templates/alerts.html +++ b/templates/alerts.html @@ -84,7 +84,7 @@ - + diff --git a/templates/bands.html b/templates/bands.html index d408b8e..8b63d4f 100644 --- a/templates/bands.html +++ b/templates/bands.html @@ -76,8 +76,8 @@ - - + + diff --git a/templates/base.html b/templates/base.html index f1bc96a..b87f82c 100644 --- a/templates/base.html +++ b/templates/base.html @@ -1,6 +1,6 @@ {% extends "skeleton.html" %} {% block head_extra %} - + @@ -16,10 +16,10 @@ window.fetchEventSource = fetchEventSource; - - - - + + + + {% end %} {% block body %}