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:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user