mirror of
https://git.ianrenton.com/ian/spothole.git
synced 2026-09-20 14:27:42 +00:00
Fix a bug in PNP spot handling where an exception would be thrown if an activity had a location name but not a reference ID.
This commit is contained in:
@@ -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)
|
||||
|
||||
@@ -77,7 +77,7 @@
|
||||
|
||||
</div>
|
||||
|
||||
<script src="/static/js/add-spot.js?v=1789894090"></script>
|
||||
<script src="/static/js/add-spot.js?v=1789895439"></script>
|
||||
<script>$(document).ready(function () {
|
||||
$("#nav-link-add-spot").addClass("active");
|
||||
}); <!-- highlight active page in nav --></script>
|
||||
|
||||
@@ -85,7 +85,7 @@
|
||||
|
||||
</div>
|
||||
|
||||
<script src="/static/js/alerts.js?v=1789894090"></script>
|
||||
<script src="/static/js/alerts.js?v=1789895439"></script>
|
||||
<script>$(document).ready(function () {
|
||||
$("#nav-link-alerts").addClass("active");
|
||||
}); <!-- highlight active page in nav --></script>
|
||||
|
||||
@@ -76,8 +76,8 @@
|
||||
|
||||
</div>
|
||||
|
||||
<script src="/static/js/spotsbandsandmap.js?v=1789894090"></script>
|
||||
<script src="/static/js/bands.js?v=1789894090"></script>
|
||||
<script src="/static/js/spotsbandsandmap.js?v=1789895439"></script>
|
||||
<script src="/static/js/bands.js?v=1789895439"></script>
|
||||
<script>$(document).ready(function () {
|
||||
$("#nav-link-bands").addClass("active");
|
||||
}); <!-- highlight active page in nav --></script>
|
||||
|
||||
+5
-5
@@ -1,6 +1,6 @@
|
||||
{% extends "skeleton.html" %}
|
||||
{% block head_extra %}
|
||||
<link rel="stylesheet" href="/static/css/style.css?v=1789894090" type="text/css">
|
||||
<link rel="stylesheet" href="/static/css/style.css?v=1789895439" type="text/css">
|
||||
<link href="/static/vendor/css/bootstrap-5.3.8.min.css" rel="stylesheet">
|
||||
<link href="/static/vendor/css/fontawesome-6.7.2.min.css" rel="stylesheet">
|
||||
<link href="/static/vendor/css/solid-6.7.2.min.css" rel="stylesheet">
|
||||
@@ -16,10 +16,10 @@
|
||||
window.fetchEventSource = fetchEventSource;
|
||||
</script>
|
||||
|
||||
<script src="/static/js/utils.js?v=1789894090"></script>
|
||||
<script src="/static/js/ui-ham.js?v=1789894090"></script>
|
||||
<script src="/static/js/geo.js?v=1789894090"></script>
|
||||
<script src="/static/js/common.js?v=1789894090"></script>
|
||||
<script src="/static/js/utils.js?v=1789895439"></script>
|
||||
<script src="/static/js/ui-ham.js?v=1789895439"></script>
|
||||
<script src="/static/js/geo.js?v=1789895439"></script>
|
||||
<script src="/static/js/common.js?v=1789895439"></script>
|
||||
{% end %}
|
||||
{% block body %}
|
||||
<div class="container">
|
||||
|
||||
@@ -284,7 +284,7 @@
|
||||
</div>
|
||||
|
||||
<script src="/static/vendor/js/chart-4.4.9.umd.min.js"></script>
|
||||
<script src="/static/js/conditions.js?v=1789894090"></script>
|
||||
<script src="/static/js/conditions.js?v=1789895439"></script>
|
||||
<script>$(document).ready(function () {
|
||||
$("#nav-link-conditions").addClass("active");
|
||||
}); <!-- highlight active page in nav --></script>
|
||||
|
||||
+2
-2
@@ -113,8 +113,8 @@
|
||||
const CARTODB_API_KEY = "{{ web_ui_options.get('cartodb_api_key', '') }}";
|
||||
</script>
|
||||
|
||||
<script src="/static/js/spotsbandsandmap.js?v=1789894090"></script>
|
||||
<script src="/static/js/map.js?v=1789894090"></script>
|
||||
<script src="/static/js/spotsbandsandmap.js?v=1789895439"></script>
|
||||
<script src="/static/js/map.js?v=1789895439"></script>
|
||||
<script>$(document).ready(function () {
|
||||
$("#nav-link-map").addClass("active");
|
||||
}); <!-- highlight active page in nav --></script>
|
||||
|
||||
@@ -125,8 +125,8 @@
|
||||
|
||||
</div>
|
||||
|
||||
<script src="/static/js/spotsbandsandmap.js?v=1789894090"></script>
|
||||
<script src="/static/js/spots.js?v=1789894090"></script>
|
||||
<script src="/static/js/spotsbandsandmap.js?v=1789895439"></script>
|
||||
<script src="/static/js/spots.js?v=1789895439"></script>
|
||||
<script>$(document).ready(function () {
|
||||
$("#nav-link-spots").addClass("active");
|
||||
}); <!-- highlight active page in nav --></script>
|
||||
|
||||
@@ -96,7 +96,7 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script src="/static/js/status.js?v=1789894090"></script>
|
||||
<script src="/static/js/status.js?v=1789895439"></script>
|
||||
<script>
|
||||
$(document).ready(function () {
|
||||
$("#nav-link-status").addClass("active");
|
||||
|
||||
Reference in New Issue
Block a user