mirror of
https://git.ianrenton.com/ian/spothole.git
synced 2026-09-20 06:17:41 +00:00
Fix icon and ref_type disappearing from SIG Ref lookups
This commit is contained in:
@@ -29,14 +29,11 @@ def get_sig_ref_info(sig_name, ref_id):
|
||||
# Prepare the object to be returned
|
||||
sig_ref = SIGRef(sig=sig_name, id=ref_id)
|
||||
|
||||
# We can always get the reference type and the icon from the SIG itself, if the reference data doesn't already
|
||||
# contain it. If the sig ref already has this data, it should be used for preference.
|
||||
# We can always get the reference type and the icon from the SIG itself
|
||||
for sig in SIGS:
|
||||
if sig.name.upper() == sig_name.upper():
|
||||
if not sig_ref.ref_type:
|
||||
sig_ref.ref_type = sig.ref_type
|
||||
if not sig_ref.icon:
|
||||
sig_ref.icon = sig.icon
|
||||
sig_ref.ref_type = sig.ref_type
|
||||
sig_ref.icon = sig.icon
|
||||
|
||||
try:
|
||||
### FUDGES ###
|
||||
@@ -45,7 +42,7 @@ def get_sig_ref_info(sig_name, ref_id):
|
||||
# activators add leading zeros. We also need to normalise "DME 01234" to "DME-01234" to match what's in our
|
||||
# database.
|
||||
if sig_name.upper() == "DME":
|
||||
match = re.match(r"DME[\- ]\d{3,5}", ref_id, re.IGNORECASE)
|
||||
match = re.match(r"DME[\- ](\d{3,5})", ref_id, re.IGNORECASE)
|
||||
number = match.group(1)
|
||||
return f"DME-{number.zfill(5)}"
|
||||
|
||||
@@ -113,12 +110,14 @@ def get_sig_ref_info(sig_name, ref_id):
|
||||
|
||||
### ACTUAL LOOKUP ###
|
||||
#
|
||||
# OK, this is something we have to look up. Now check to see if our data store contains reference data and use
|
||||
# that.
|
||||
# OK, this is something we have to look up. Now check to see if our data store contains reference data and if
|
||||
# so, copy the data into the sig_ref object
|
||||
key = f"{sig_name}:{ref_id}"
|
||||
lookup_data = DATA_STORE.sigrefs.get(key) if key in DATA_STORE.sigrefs else None
|
||||
if lookup_data:
|
||||
return lookup_data
|
||||
for key, value in lookup_data.__dict__.items():
|
||||
if value is not None and sig_ref.__dict__.get(key) is None:
|
||||
sig_ref.__dict__[key] = value
|
||||
|
||||
else:
|
||||
# Maybe a super new reference we don't know about yet, but more likely a typo or a test reference,
|
||||
|
||||
@@ -77,7 +77,7 @@
|
||||
|
||||
</div>
|
||||
|
||||
<script src="/static/js/add-spot.js?v=1788598625"></script>
|
||||
<script src="/static/js/add-spot.js?v=1788599677"></script>
|
||||
<script>$(document).ready(function () {
|
||||
$("#nav-link-add-spot").addClass("active");
|
||||
}); <!-- highlight active page in nav --></script>
|
||||
|
||||
@@ -81,7 +81,7 @@
|
||||
|
||||
</div>
|
||||
|
||||
<script src="/static/js/alerts.js?v=1788598625"></script>
|
||||
<script src="/static/js/alerts.js?v=1788599678"></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=1788598625"></script>
|
||||
<script src="/static/js/bands.js?v=1788598625"></script>
|
||||
<script src="/static/js/spotsbandsandmap.js?v=1788599677"></script>
|
||||
<script src="/static/js/bands.js?v=1788599677"></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=1788598625" type="text/css">
|
||||
<link rel="stylesheet" href="/static/css/style.css?v=1788599677" 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=1788598625"></script>
|
||||
<script src="/static/js/ui-ham.js?v=1788598625"></script>
|
||||
<script src="/static/js/geo.js?v=1788598625"></script>
|
||||
<script src="/static/js/common.js?v=1788598625"></script>
|
||||
<script src="/static/js/utils.js?v=1788599677"></script>
|
||||
<script src="/static/js/ui-ham.js?v=1788599677"></script>
|
||||
<script src="/static/js/geo.js?v=1788599677"></script>
|
||||
<script src="/static/js/common.js?v=1788599677"></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=1788598625"></script>
|
||||
<script src="/static/js/conditions.js?v=1788599677"></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=1788598625"></script>
|
||||
<script src="/static/js/map.js?v=1788598625"></script>
|
||||
<script src="/static/js/spotsbandsandmap.js?v=1788599678"></script>
|
||||
<script src="/static/js/map.js?v=1788599678"></script>
|
||||
<script>$(document).ready(function () {
|
||||
$("#nav-link-map").addClass("active");
|
||||
}); <!-- highlight active page in nav --></script>
|
||||
|
||||
@@ -113,8 +113,8 @@
|
||||
|
||||
</div>
|
||||
|
||||
<script src="/static/js/spotsbandsandmap.js?v=1788598625"></script>
|
||||
<script src="/static/js/spots.js?v=1788598625"></script>
|
||||
<script src="/static/js/spotsbandsandmap.js?v=1788599677"></script>
|
||||
<script src="/static/js/spots.js?v=1788599677"></script>
|
||||
<script>$(document).ready(function () {
|
||||
$("#nav-link-spots").addClass("active");
|
||||
}); <!-- highlight active page in nav --></script>
|
||||
|
||||
@@ -86,7 +86,7 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script src="/static/js/status.js?v=1788598625"></script>
|
||||
<script src="/static/js/status.js?v=1788599677"></script>
|
||||
<script>
|
||||
$(document).ready(function () {
|
||||
$("#nav-link-status").addClass("active");
|
||||
|
||||
Reference in New Issue
Block a user