Refactor activity names to use an enum instead of a string to avoid typos #147

This commit is contained in:
Ian Renton
2026-09-18 18:09:41 +01:00
parent ab79e7e01c
commit e5caf7353d
61 changed files with 735 additions and 638 deletions
+54
View File
@@ -90,6 +90,60 @@ class LocationSourceForCallsign(str, Enum):
DXCC = "DXCC"
# Definitions of every activity Spothole knows about, keyed by the ActivityName enum. An enum is used for the
# names to avoid typos when using literal strings like "POTA" all over the place.
class ActivityName(str, Enum):
"""Canonical name of every activity. Spothole uses these rather than literals like "POTA" around the code
to ensure I don't accidentally introduce typos."""
CONTEST = "Contest"
DXPEDITION = "DXpedition"
SATELLITE = "Satellite"
EME = "EME"
AERONAUTICAL_MOBILE = "/AM"
MARITIME_MOBILE = "/MM"
QRP = "QRP"
POTA = "POTA"
SOTA = "SOTA"
WWFF = "WWFF"
GMA = "GMA"
WWBOTA = "WWBOTA"
HEMA = "HEMA"
IOTA = "IOTA"
GMA_ISLANDS = "GMA Islands"
ARLHS = "ARLHS"
ILLW = "ILLW"
MOTA = "MOTA"
SIOTA = "SIOTA"
WCA = "WCA"
ZLOTA = "ZLOTA"
WOTA = "WOTA"
BOTA = "BOTA"
KRMNPA = "KRMNPA"
SANPCPA = "SANPCPA"
LLOTA = "LLOTA"
TOWERS = "Towers"
TILES = "Tiles"
RADAR_RALLY = "RaDAR Rally"
WAB = "WAB"
WAI = "WAI"
DMF = "DMF"
DME = "DME"
FEA = "FEA"
DMUE = "DMUE"
DMVE = "DMVE"
DCE = "DCE"
DEFE = "DEFE"
DTMBA = "DTMBA"
BIWOTA = "BIWOTA"
COTA = "COTA"
PGA = "PGA"
TOILETS = "Toilets"
def __str__(self):
return str(self.value)
class ActivityRefType(str, Enum):
"""Type of an activity reference."""