mirror of
https://git.ianrenton.com/ian/spothole.git
synced 2026-09-20 14:27:42 +00:00
Refactor activity names to use an enum instead of a string to avoid typos #147
This commit is contained in:
@@ -4,7 +4,8 @@ import pytz
|
||||
import requests
|
||||
|
||||
from core.constants import HTTP_HEADERS
|
||||
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
|
||||
@@ -33,11 +34,11 @@ class POTA(HTTPSpotProvider):
|
||||
freq=float(source_spot["frequency"]) * 1000 if source_spot["frequency"] != "INVALID" else None,
|
||||
mode=Mode.from_name(source_spot["mode"].upper()),
|
||||
comment=source_spot["comments"],
|
||||
sig="POTA",
|
||||
sig=ActivityName.POTA,
|
||||
sig_refs=[
|
||||
ActivityRef(
|
||||
id=source_spot["reference"],
|
||||
sig="POTA",
|
||||
sig=ActivityName.POTA,
|
||||
name=source_spot["name"],
|
||||
latitude=source_spot["latitude"],
|
||||
longitude=source_spot["longitude"],
|
||||
@@ -58,7 +59,7 @@ class POTA(HTTPSpotProvider):
|
||||
return new_spots
|
||||
|
||||
def can_submit_spot(self, activity):
|
||||
return activity == "POTA"
|
||||
return activity == ActivityName.POTA
|
||||
|
||||
def submit_spot(self, spot, credentials):
|
||||
sig_ref = spot.sig_refs[0].id if spot.sig_refs else None
|
||||
|
||||
Reference in New Issue
Block a user