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
+9 -4
View File
@@ -8,7 +8,8 @@ import pytz
from rss_parser import Parser
from rss_parser.models.rss import RSS
from core.enums import ActivityRefType, Mode
from core.enums import 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
@@ -90,8 +91,12 @@ class WOTA(HTTPSpotProvider):
freq=freq_hz,
mode=Mode.from_name(mode),
comment=comment,
sig="WOTA",
sig_refs=[ActivityRef(id=ref, sig="WOTA", name=ref_name, ref_type=ActivityRefType.SUMMIT)] if ref else [],
sig=ActivityName.WOTA,
sig_refs=(
[ActivityRef(id=ref, sig=ActivityName.WOTA, name=ref_name, ref_type=ActivityRefType.SUMMIT)]
if ref
else []
),
time=time.timestamp(),
)
@@ -105,7 +110,7 @@ class WOTA(HTTPSpotProvider):
return new_spots
def can_submit_spot(self, activity):
return activity == "WOTA"
return activity == ActivityName.WOTA
def submit_spot(self, spot, credentials):
# TODO Ask M5TEA if he's happy to share how this is done from his app