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
+4 -3
View File
@@ -3,6 +3,7 @@ from datetime import datetime
import pytz
from core.enums import Mode
from core.enums import ActivityName
from data.activity_ref import ActivityRef
from data.spot import Spot
from providers.spot.http_spot_provider import HTTPSpotProvider
@@ -35,11 +36,11 @@ class ZLOTA(HTTPSpotProvider):
freq=freq_hz,
mode=Mode.from_name(source_spot["mode"].upper().strip()),
comment=source_spot["comments"],
sig="ZLOTA",
sig=ActivityName.ZLOTA,
sig_refs=[
ActivityRef(
id=source_spot["reference"],
sig="ZLOTA",
sig=ActivityName.ZLOTA,
name=source_spot["name"],
)
],
@@ -52,7 +53,7 @@ class ZLOTA(HTTPSpotProvider):
return new_spots
def can_submit_spot(self, activity):
return activity == "ZLOTA"
return activity == ActivityName.ZLOTA
def submit_spot(self, spot, credentials):
# TODO: Implement. Spotting to ZLOTA is supported via POST, see https://ontheair.nz/api