diff --git a/data/spot.py b/data/spot.py index 896eb6c..85ae3ad 100644 --- a/data/spot.py +++ b/data/spot.py @@ -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: diff --git a/templates/add_spot.html b/templates/add_spot.html index 1b8667c..8f4d8f1 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 a3891e8..08be530 100644 --- a/templates/alerts.html +++ b/templates/alerts.html @@ -85,7 +85,7 @@ - + diff --git a/templates/bands.html b/templates/bands.html index bc418a9..4756f26 100644 --- a/templates/bands.html +++ b/templates/bands.html @@ -76,8 +76,8 @@ - - + + diff --git a/templates/base.html b/templates/base.html index c35dad4..f5db8e5 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 %}