diff --git a/providers/spot/parksnpeaks.py b/providers/spot/parksnpeaks.py index 45b0105..65e70da 100644 --- a/providers/spot/parksnpeaks.py +++ b/providers/spot/parksnpeaks.py @@ -68,21 +68,33 @@ class ParksNPeaks(HTTPSpotProvider): # Record activity information activity = source_spot["actClass"].upper() ref_id = source_spot["actSiteID"] + if activity: spot.sig = activity - activity_refs = [] + if ref_id: activity_refs = [ ActivityRef( - id=source_spot["actSiteID"], + id=ref_id, sig=activity, + # Free text location is not present in all spots, so only add it if it's set + name=source_spot["actLocation"] + if "actLocation" in source_spot and source_spot["actLocation"] != "" + else None, ) ] spot.sig_refs = activity_refs - # Free text location is not present in all spots, so only add it if it's set - if "actLocation" in source_spot and source_spot["actLocation"] != "": - activity_refs[0].name = source_spot["actLocation"] + else: + # If no actSiteID is set, e.g. because actClass is "QRP", sometimes we still have an actLocation + # which is free text like "SOTA G/SC-001". If we have that, and not a normal comment field, use + # that location as the comment field so the information doesn't get lost. + if ( + "actLocation" in source_spot + and source_spot["actLocation"] != "" + and ("actComments" not in source_spot or source_spot["actComments"] == "") + ): + spot.comment = source_spot["actLocation"] # Log a warning for the developer if PnP gives us an unknown programme we've never seen before if activity not in [ @@ -95,8 +107,11 @@ class ParksNPeaks(HTTPSpotProvider): ActivityName.KRMNPA, ActivityName.SANPCPA, ActivityName.LLOTA, + ActivityName.QRP, ]: - logger.warning(f"PNP spot found with activity {activity}, developer needs to add support for this!") + logger.warning( + f"PNP spot found with activity {activity}, developer needs to add support for this!" + ) # Add new spot to the list new_spots.append(spot) diff --git a/templates/add_spot.html b/templates/add_spot.html index 0de4bfe..9f0f32b 100644 --- a/templates/add_spot.html +++ b/templates/add_spot.html @@ -77,7 +77,7 @@ - + diff --git a/templates/alerts.html b/templates/alerts.html index 7baf852..7e778dc 100644 --- a/templates/alerts.html +++ b/templates/alerts.html @@ -85,7 +85,7 @@ - + diff --git a/templates/bands.html b/templates/bands.html index 0a37e54..d21ba65 100644 --- a/templates/bands.html +++ b/templates/bands.html @@ -76,8 +76,8 @@ - - + + diff --git a/templates/base.html b/templates/base.html index 099c30d..448d46c 100644 --- a/templates/base.html +++ b/templates/base.html @@ -1,6 +1,6 @@ {% extends "skeleton.html" %} {% block head_extra %} - + @@ -16,10 +16,10 @@ window.fetchEventSource = fetchEventSource; - - - - + + + + {% end %} {% block body %}