mirror of
https://git.ianrenton.com/ian/spothole.git
synced 2026-09-20 22:37:44 +00:00
Fix order in which grids are parsed out of comments
This commit is contained in:
+19
-19
@@ -380,11 +380,19 @@ class Spot:
|
||||
self.propagation_mode = mode_tag
|
||||
logger.info(f"Seen a new propagation mode tag not yet in the system: {mode_tag}")
|
||||
|
||||
# Set activities based on propagation mode
|
||||
if self.propagation_mode == "Satellite" and not self.sig:
|
||||
self.sig = ActivityName.SATELLITE
|
||||
if self.propagation_mode == "Earth-Moon-Earth" and not self.sig:
|
||||
self.sig = ActivityName.EME
|
||||
# Parse "de_grid -> dx_grid" structures from the comment
|
||||
if self.comment:
|
||||
grid_match = re.search(
|
||||
r"\b([A-Ra-r]{2}\d{2}(?:[A-Xa-x]{2}(?:\d{2})?)?)\s*->\s*([A-Ra-r]{2}\d{2}(?:[A-Xa-x]{2}(?:\d{2})?)?)\b",
|
||||
self.comment,
|
||||
)
|
||||
if grid_match:
|
||||
# regex matches, so extract grids:
|
||||
if not self.de_grid:
|
||||
self.de_grid = grid_match.group(1).upper()
|
||||
if not self.dx_grid:
|
||||
self.dx_grid = grid_match.group(2).upper()
|
||||
self.dx_location_source = LocationSourceForSpot.GRID
|
||||
|
||||
# Parse 6-digit grid structures from the comment if the frequency is VHF or above, as it's common to see
|
||||
# VHF+ operators spotted with their grid
|
||||
@@ -397,6 +405,12 @@ class Spot:
|
||||
self.dx_grid = grid_match.group(1).upper()
|
||||
self.dx_location_source = LocationSourceForSpot.GRID
|
||||
|
||||
# Set activities based on propagation mode
|
||||
if self.propagation_mode == "Satellite" and not self.sig:
|
||||
self.sig = ActivityName.SATELLITE
|
||||
if self.propagation_mode == "Earth-Moon-Earth" and not self.sig:
|
||||
self.sig = ActivityName.EME
|
||||
|
||||
# Set activities based on the DX callsign suffix
|
||||
if self.dx_call and not self.sig:
|
||||
if self.dx_call.upper().endswith(ActivityName.AERONAUTICAL_MOBILE):
|
||||
@@ -420,20 +434,6 @@ class Spot:
|
||||
self.sig = ActivityName.DXPEDITION
|
||||
break
|
||||
|
||||
# Parse "de_grid -> dx_grid" structures from the comment
|
||||
if self.comment:
|
||||
grid_match = re.search(
|
||||
r"\b([A-Ra-r]{2}\d{2}(?:[A-Xa-x]{2}(?:\d{2})?)?)\s*->\s*([A-Ra-r]{2}\d{2}(?:[A-Xa-x]{2}(?:\d{2})?)?)\b",
|
||||
self.comment,
|
||||
)
|
||||
if grid_match:
|
||||
# regex matches, so extract grids:
|
||||
if not self.dx_grid:
|
||||
self.dx_grid = grid_match.group(1).upper()
|
||||
self.dx_location_source = LocationSourceForSpot.GRID
|
||||
if not self.de_grid:
|
||||
self.de_grid = grid_match.group(2).upper()
|
||||
|
||||
# DX Grid to lat/lon and vice versa in case one is missing
|
||||
if self.dx_grid and (not self.dx_latitude or not self.dx_longitude):
|
||||
try:
|
||||
|
||||
@@ -77,7 +77,7 @@
|
||||
|
||||
</div>
|
||||
|
||||
<script src="/static/js/add-spot.js?v=1789896773"></script>
|
||||
<script src="/static/js/add-spot.js?v=1789927308"></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=1789896773"></script>
|
||||
<script src="/static/js/alerts.js?v=1789927308"></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=1789896773"></script>
|
||||
<script src="/static/js/bands.js?v=1789896773"></script>
|
||||
<script src="/static/js/spotsbandsandmap.js?v=1789927308"></script>
|
||||
<script src="/static/js/bands.js?v=1789927308"></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=1789896773" type="text/css">
|
||||
<link rel="stylesheet" href="/static/css/style.css?v=1789927308" 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=1789896773"></script>
|
||||
<script src="/static/js/ui-ham.js?v=1789896773"></script>
|
||||
<script src="/static/js/geo.js?v=1789896773"></script>
|
||||
<script src="/static/js/common.js?v=1789896773"></script>
|
||||
<script src="/static/js/utils.js?v=1789927308"></script>
|
||||
<script src="/static/js/ui-ham.js?v=1789927308"></script>
|
||||
<script src="/static/js/geo.js?v=1789927308"></script>
|
||||
<script src="/static/js/common.js?v=1789927308"></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=1789896773"></script>
|
||||
<script src="/static/js/conditions.js?v=1789927308"></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=1789896773"></script>
|
||||
<script src="/static/js/map.js?v=1789896773"></script>
|
||||
<script src="/static/js/spotsbandsandmap.js?v=1789927308"></script>
|
||||
<script src="/static/js/map.js?v=1789927308"></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=1789896773"></script>
|
||||
<script src="/static/js/spots.js?v=1789896773"></script>
|
||||
<script src="/static/js/spotsbandsandmap.js?v=1789927308"></script>
|
||||
<script src="/static/js/spots.js?v=1789927308"></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=1789896773"></script>
|
||||
<script src="/static/js/status.js?v=1789927308"></script>
|
||||
<script>
|
||||
$(document).ready(function () {
|
||||
$("#nav-link-status").addClass("active");
|
||||
|
||||
Reference in New Issue
Block a user