Allow spots and alerts to have multiple activities #143

This commit is contained in:
Ian Renton
2026-09-24 22:57:46 +01:00
parent 81166dccab
commit 4477942bec
34 changed files with 217 additions and 157 deletions
+11 -11
View File
@@ -106,49 +106,49 @@ class GMA(HTTPSpotProvider):
if "sota" in ref_info and ref_info["sota"] != "":
spot.activity_refs[0].activity = ActivityName.SOTA
spot.activity_refs[0].ref_type = ActivityRefType.SUMMIT
spot.activity = ActivityName.SOTA
spot.add_activity(ActivityName.SOTA)
else:
spot.activity_refs[0].activity = ActivityName.GMA
spot.activity_refs[0].ref_type = ActivityRefType.SUMMIT
spot.activity = ActivityName.GMA
spot.add_activity(ActivityName.GMA)
case "POTA":
spot.activity_refs[0].activity = ActivityName.POTA
spot.activity_refs[0].ref_type = ActivityRefType.PARK
spot.activity = ActivityName.POTA
spot.add_activity(ActivityName.POTA)
case "WWFF":
spot.activity_refs[0].activity = ActivityName.WWFF
spot.activity_refs[0].ref_type = ActivityRefType.PARK
spot.activity = ActivityName.WWFF
spot.add_activity(ActivityName.WWFF)
case "IOTA Island":
spot.activity_refs[0].activity = ActivityName.IOTA
spot.activity_refs[0].ref_type = ActivityRefType.ISLAND
spot.activity = ActivityName.IOTA
spot.add_activity(ActivityName.IOTA)
case "GMA Island":
spot.activity_refs[0].activity = ActivityName.GMA_ISLANDS
spot.activity_refs[0].ref_type = ActivityRefType.ISLAND
spot.activity = ActivityName.GMA_ISLANDS
spot.add_activity(ActivityName.GMA_ISLANDS)
case "Lighthouse (ILLW)":
spot.activity_refs[0].activity = ActivityName.ILLW
spot.activity_refs[0].ref_type = ActivityRefType.LIGHTHOUSE
spot.activity = ActivityName.ILLW
spot.add_activity(ActivityName.ILLW)
case "Lighthouse (ARLHS)":
spot.activity_refs[0].activity = ActivityName.ARLHS
spot.activity_refs[0].ref_type = ActivityRefType.LIGHTHOUSE
spot.activity = ActivityName.ARLHS
spot.add_activity(ActivityName.ARLHS)
case "Castle":
spot.activity_refs[0].activity = ActivityName.WCA
spot.activity_refs[0].ref_type = ActivityRefType.CASTLE
spot.activity = ActivityName.WCA
spot.add_activity(ActivityName.WCA)
case "Mill":
spot.activity_refs[0].activity = ActivityName.MOTA
spot.activity_refs[0].ref_type = ActivityRefType.MILL
spot.activity = ActivityName.MOTA
spot.add_activity(ActivityName.MOTA)
case _:
logger.warning(
f"GMA spot found with ref type {ref_info['reftype']}, developer needs to add support for this!"
)
spot.activity_refs[0].activity = ref_info["reftype"]
spot.activity = ref_info["reftype"]
spot.add_activity(ref_info["reftype"])
elif not ref_response.from_cache:
if not ref_response.ok:
+1 -1
View File
@@ -62,7 +62,7 @@ class HEMA(HTTPSpotProvider):
freq=float(freq_mode_match.group(1)) * 1000000,
mode=Mode.from_name(freq_mode_match.group(2).upper()),
comment=spotter_comment_match.group(2),
activity=ActivityName.HEMA,
activities=[ActivityName.HEMA],
activity_refs=[
ActivityRef(
id=spot_items[3].upper(),
+1 -1
View File
@@ -34,7 +34,7 @@ class LLOTA(HTTPSpotProvider):
freq=float(source_spot["frequency"]) * 1000000,
mode=Mode.from_name(source_spot["mode"].upper()),
comment=comment,
activity=ActivityName.LLOTA,
activities=[ActivityName.LLOTA],
activity_refs=[
ActivityRef(
id=source_spot["reference"],
+2 -2
View File
@@ -70,7 +70,7 @@ class ParksNPeaks(HTTPSpotProvider):
ref_id = source_spot["actSiteID"]
if activity:
spot.activity = activity
spot.add_activity(activity)
if ref_id:
activity_refs = [
@@ -130,7 +130,7 @@ class ParksNPeaks(HTTPSpotProvider):
)
ref_id = spot.activity_refs[0].id if spot.activity_refs else ""
body = {
"actClass": spot.activity or "",
"actClass": next((a for a in spot.activities if self.can_submit_spot(a)), ""),
"actCallsign": spot.dx_call,
"actSite": ref_id,
"mode": spot.mode or "",
+1 -1
View File
@@ -33,7 +33,7 @@ class POTA(HTTPSpotProvider):
freq=float(source_spot["frequency"]) * 1000 if source_spot["frequency"] != "INVALID" else None,
mode=Mode.from_name(source_spot["mode"].upper()),
comment=source_spot["comments"],
activity=ActivityName.POTA,
activities=[ActivityName.POTA],
activity_refs=[
ActivityRef(
id=source_spot["reference"],
+1 -1
View File
@@ -57,7 +57,7 @@ class SOTA(HTTPSpotProvider):
# Seen SOTA spots with no frequency!
mode=Mode.from_name(source_spot["mode"].upper()),
comment=source_spot["comments"],
activity=ActivityName.SOTA,
activities=[ActivityName.SOTA],
activity_refs=[
ActivityRef(
id=source_spot["summitCode"],
+1 -1
View File
@@ -59,7 +59,7 @@ class Tiles(HTTPSpotProvider):
freq=freq,
mode=Mode.from_name(source_spot["mode"].upper()),
comment=source_spot["notes"],
activity=ActivityName.TILES,
activities=[ActivityName.TILES],
# Tiles spots can include POTA & SOTA references, but ignore those on the basis that we will get them separately from the POTA/SOTA providers anyway.
# Just take the grid reference itself as the single Tiles activity reference.
activity_refs=[
+1 -1
View File
@@ -34,7 +34,7 @@ class Towers(HTTPSpotProvider):
dx_call=source_spot["call"].upper(),
freq=likely_freq,
comment=source_spot["comment"],
activity=ActivityName.TOWERS,
activities=[ActivityName.TOWERS],
activity_refs=[
ActivityRef(id=source_spot["ref"], activity=ActivityName.TOWERS, ref_type=ActivityRefType.TOWER)
],
+1 -1
View File
@@ -92,7 +92,7 @@ class WOTA(HTTPSpotProvider):
freq=freq_hz,
mode=Mode.from_name(mode),
comment=comment,
activity=ActivityName.WOTA,
activities=[ActivityName.WOTA],
activity_refs=(
[
ActivityRef(
+1 -1
View File
@@ -38,7 +38,7 @@ class WWBOTA(SSESpotProvider):
freq=float(source_spot["freq"]) * 1000000,
mode=Mode.from_name(source_spot["mode"].upper()) if source_spot.get("mode") else None,
comment=source_spot["comment"],
activity=ActivityName.WWBOTA,
activities=[ActivityName.WWBOTA],
activity_refs=refs,
time=datetime.fromisoformat(source_spot["time"].replace("Z", "+00:00")).timestamp(),
# WWBOTA spots can contain multiple references for bunkers being activated simultaneously. For
+1 -1
View File
@@ -30,7 +30,7 @@ class WWFF(HTTPSpotProvider):
freq=float(source_spot["frequency_khz"]) * 1000,
mode=Mode.from_name(source_spot["mode"].upper()),
comment=source_spot["remarks"],
activity=ActivityName.WWFF,
activities=[ActivityName.WWFF],
activity_refs=[
ActivityRef(
id=source_spot["reference"],
+1 -1
View File
@@ -37,7 +37,7 @@ class XOTA(WebsocketSpotProvider):
dx_call=source_spot["stationCallSign"].upper(),
freq=float(source_spot["freq"]) * 1000,
mode=Mode.from_name(source_spot["mode"].upper()),
activity=self.ACTIVITY,
activities=[self.ACTIVITY] if self.ACTIVITY else [],
activity_refs=[
ActivityRef(
id=ref_id,
+1 -1
View File
@@ -35,7 +35,7 @@ class ZLOTA(HTTPSpotProvider):
freq=freq_hz,
mode=Mode.from_name(source_spot["mode"].upper().strip()),
comment=source_spot["comments"],
activity=ActivityName.ZLOTA,
activities=[ActivityName.ZLOTA],
activity_refs=[
ActivityRef(
id=source_spot["reference"],