Add EME SIG and do some refactoring

This commit is contained in:
Ian Renton
2026-09-11 08:33:00 +01:00
parent a4245ed5ce
commit 3bab3cb784
12 changed files with 57 additions and 47 deletions
+5 -5
View File
@@ -1,7 +1,7 @@
import hashlib
import json
import logging
from dataclasses import dataclass
from dataclasses import dataclass, field
from datetime import datetime, timedelta
import pytz
@@ -64,7 +64,7 @@ class Alert:
# Special Interest Group (SIG), e.g. outdoor activity programme such as POTA
sig: str | None = None
# SIG references. We allow multiple here for e.g. n-fer activations, unlike ADIF SIG_INFO
sig_refs: list | None = None
sig_refs: list = field(default_factory=list)
# Timing info
@@ -128,13 +128,13 @@ class Alert:
# Fetch SIG data. In case a particular API doesn't provide a full set of name, lat, lon & grid for a reference
# in its initial call, we use this code to populate the rest of the data. This includes working out grid refs
# from WAB and WAI, which count as a SIG even though there's no real lookup, just maths
if self.sig_refs and len(self.sig_refs) > 0:
if self.sig_refs:
for sig_ref in self.sig_refs:
populate_missing_sig_ref_info(sig_ref)
# If the spot itself doesn't have a SIG yet, but we have at least one SIG reference, take that reference's SIG
# and apply it to the whole spot.
if self.sig_refs and len(self.sig_refs) > 0 and self.sig_refs[0] and not self.sig:
if self.sig_refs and self.sig_refs[0] and not self.sig:
self.sig = self.sig_refs[0].sig
# Create an ID based on the source and source ID if possible, as these guaranee uniqueness. If there is no
@@ -160,7 +160,7 @@ class Alert:
self.icon = "fa-trophy"
elif self.alert_type == AlertType.CONTEST:
self.icon = "fa-satellite"
elif self.sig_refs and len(self.sig_refs) > 0 and self.sig_refs[0].icon:
elif self.sig_refs and self.sig_refs[0].icon:
self.icon = self.sig_refs[0].icon
except Exception: