mirror of
https://git.ianrenton.com/ian/spothole.git
synced 2026-09-20 22:37:44 +00:00
Refactor activity names to use an enum instead of a string to avoid typos #147
This commit is contained in:
@@ -2,7 +2,8 @@ from datetime import datetime
|
||||
|
||||
import pytz
|
||||
|
||||
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
|
||||
@@ -30,11 +31,11 @@ class WWFF(HTTPSpotProvider):
|
||||
freq=float(source_spot["frequency_khz"]) * 1000,
|
||||
mode=Mode.from_name(source_spot["mode"].upper()),
|
||||
comment=source_spot["remarks"],
|
||||
sig="WWFF",
|
||||
sig=ActivityName.WWFF,
|
||||
sig_refs=[
|
||||
ActivityRef(
|
||||
id=source_spot["reference"],
|
||||
sig="WWFF",
|
||||
sig=ActivityName.WWFF,
|
||||
name=source_spot["reference_name"],
|
||||
latitude=source_spot["latitude"],
|
||||
longitude=source_spot["longitude"],
|
||||
@@ -52,7 +53,7 @@ class WWFF(HTTPSpotProvider):
|
||||
return new_spots
|
||||
|
||||
def can_submit_spot(self, activity):
|
||||
return activity == "WWFF"
|
||||
return activity == ActivityName.WWFF
|
||||
|
||||
def submit_spot(self, spot, credentials):
|
||||
# TODO: Implement. Spotting to WWFF should be possible, need to look up the Spotline docs or copy approach from
|
||||
|
||||
Reference in New Issue
Block a user