Giant refactor to rebrand "SIG" as "Activity" anywhere that doesn't touch API or config file (which is to be addressed in a future breaking change). #147

This commit is contained in:
Ian Renton
2026-09-18 14:54:11 +01:00
parent 556ea56378
commit 81cd686a00
96 changed files with 1208 additions and 1170 deletions
+14 -14
View File
@@ -4,9 +4,9 @@ from datetime import datetime
import pytz
from core.constants import HTTP_HEADERS
from core.enums import Mode, SIGRefType
from core.enums import ActivityRefType, Mode
from core.url_data_cache import URLDataCache
from data.sig_ref import SIGRef
from data.activity_ref import ActivityRef
from data.spot import Spot
from providers.spot.http_spot_provider import HTTPSpotProvider
@@ -69,7 +69,7 @@ class GMA(HTTPSpotProvider):
mode=Mode.from_name(source_spot["MODE"].upper()) if "<>" not in source_spot["MODE"] else None,
comment=source_spot["TEXT"],
sig_refs=[
SIGRef(
ActivityRef(
id=source_spot["REF"],
sig="",
name=source_spot["NAME"],
@@ -83,7 +83,7 @@ class GMA(HTTPSpotProvider):
qrt=source_spot["QRG"] == "QRT",
)
# GMA doesn't give what programme (SIG) the reference is for until we separately look it up.
# GMA doesn't give what programme (activity) the reference is for until we separately look it up.
if "REF" in source_spot:
try:
ref_response = self._url_data_cache.get(
@@ -114,31 +114,31 @@ class GMA(HTTPSpotProvider):
match ref_info["reftype"]:
case "Summit":
spot.sig_refs[0].sig = "GMA"
spot.sig_refs[0].ref_type = SIGRefType.SUMMIT
spot.sig_refs[0].ref_type = ActivityRefType.SUMMIT
spot.sig = "GMA"
case "IOTA Island":
spot.sig_refs[0].sig = "IOTA"
spot.sig_refs[0].ref_type = SIGRefType.ISLAND
spot.sig_refs[0].ref_type = ActivityRefType.ISLAND
spot.sig = "IOTA"
case "GMA Island":
spot.sig_refs[0].sig = "GMA Islands"
spot.sig_refs[0].ref_type = SIGRefType.ISLAND
spot.sig_refs[0].ref_type = ActivityRefType.ISLAND
spot.sig = "GMA Islands"
case "Lighthouse (ILLW)":
spot.sig_refs[0].sig = "ILLW"
spot.sig_refs[0].ref_type = SIGRefType.LIGHTHOUSE
spot.sig_refs[0].ref_type = ActivityRefType.LIGHTHOUSE
spot.sig = "ILLW"
case "Lighthouse (ARLHS)":
spot.sig_refs[0].sig = "ARLHS"
spot.sig_refs[0].ref_type = SIGRefType.LIGHTHOUSE
spot.sig_refs[0].ref_type = ActivityRefType.LIGHTHOUSE
spot.sig = "ARLHS"
case "Castle":
spot.sig_refs[0].sig = "WCA"
spot.sig_refs[0].ref_type = SIGRefType.CASTLE
spot.sig_refs[0].ref_type = ActivityRefType.CASTLE
spot.sig = "WCA"
case "Mill":
spot.sig_refs[0].sig = "MOTA"
spot.sig_refs[0].ref_type = SIGRefType.MILL
spot.sig_refs[0].ref_type = ActivityRefType.MILL
spot.sig = "MOTA"
case _:
logger.warning(
@@ -158,7 +158,7 @@ class GMA(HTTPSpotProvider):
)
except Exception:
logger.exception(
f"Exception when looking up {self.REF_INFO_URL_ROOT}{source_spot['REF']}, SIG data will not be populated for the spot."
f"Exception when looking up {self.REF_INFO_URL_ROOT}{source_spot['REF']}, activity data will not be populated for the spot."
)
# Add to our list. Don't worry about de-duping, removing old spots etc. at this point;
@@ -169,8 +169,8 @@ class GMA(HTTPSpotProvider):
return new_spots
def can_submit_spot(self, sig):
return sig == "GMA"
def can_submit_spot(self, activity):
return activity == "GMA"
def submit_spot(self, spot, credentials):
# TODO: Implement.