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
+5 -4
View File
@@ -4,7 +4,8 @@ from datetime import datetime
import requests
from core.constants import HTTP_HEADERS
from core.enums import ActivityRefType, LocationSourceForSpot, Mode
from core.enums import LocationSourceForSpot, Mode
from core.enums import ActivityName, ActivityRefType
from data.activity_ref import ActivityRef
from data.spot import Spot
from providers.spot.http_spot_provider import HTTPSpotProvider
@@ -58,13 +59,13 @@ class Tiles(HTTPSpotProvider):
freq=freq,
mode=Mode.from_name(source_spot["mode"].upper()),
comment=source_spot["notes"],
sig="Tiles",
sig=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.
sig_refs=[
ActivityRef(
id=source_spot["maidenhead_grid"],
sig="Tiles",
sig=ActivityName.TILES,
name=source_spot["maidenhead_grid"],
latitude=source_spot["latitude"],
longitude=source_spot["longitude"],
@@ -84,7 +85,7 @@ class Tiles(HTTPSpotProvider):
return new_spots
def can_submit_spot(self, activity):
return activity == "Tiles"
return activity == ActivityName.TILES
def submit_spot(self, spot, credentials):
# Tiles on the air currently only supports *self* spots