Take SSIDs into account in the dedupe spots function #68

This commit is contained in:
Ian Renton
2025-10-30 10:51:56 +00:00
parent 8ec3a67cf5
commit 6ce66fdb62
2 changed files with 9 additions and 7 deletions

View File

@@ -241,17 +241,19 @@ class WebServer:
if needs_good_location: if needs_good_location:
spots = [s for s in spots if s.dx_location_good] spots = [s for s in spots if s.dx_location_good]
case "dedupe": case "dedupe":
# Ensure only the latest spot of each callsign is present in the list. This relies on the list being # Ensure only the latest spot of each callsign-SSID combo is present in the list. This relies on the
# in reverse time order, so if any future change allows re-ordering the list, that should be done # list being in reverse time order, so if any future change allows re-ordering the list, that should
# *after* this. # be done *after* this. SSIDs are deliberately included here (see issue #68) because e.g. M0TRT-7
# and M0TRT-9 APRS transponders could well be in different locations, on different frequencies etc.
dedupe = query.get(k).upper() == "TRUE" dedupe = query.get(k).upper() == "TRUE"
if dedupe: if dedupe:
spots_temp = [] spots_temp = []
already_seen = [] already_seen = []
for s in spots: for s in spots:
if s.dx_call not in already_seen: call_plus_ssid = s.dx_call + (s.dx_ssid if s.dx_ssid else "")
if call_plus_ssid not in already_seen:
spots_temp.append(s) spots_temp.append(s)
already_seen.append(s.dx_call) already_seen.append(call_plus_ssid)
spots = spots_temp spots = spots_temp
# If we have a "limit" parameter, we apply that last, regardless of where it appeared in the list of keys. # If we have a "limit" parameter, we apply that last, regardless of where it appeared in the list of keys.
if "limit" in query.keys(): if "limit" in query.keys():

View File

@@ -37,10 +37,10 @@ class APRSIS(SpotProvider):
def handle(self, data): def handle(self, data):
# Split SSID in "from" call and store separately # Split SSID in "from" call and store separately
from_parts = data["from"].split("-") from_parts = data["from"].split("-").upper()
dx_call = from_parts[0] dx_call = from_parts[0]
dx_ssid = from_parts[1] if len(from_parts) > 1 else None dx_ssid = from_parts[1] if len(from_parts) > 1 else None
via_parts = data["via"].split("-") via_parts = data["via"].split("-").upper()
de_call = via_parts[0] de_call = via_parts[0]
de_ssid = via_parts[1] if len(via_parts) > 1 else None de_ssid = via_parts[1] if len(via_parts) > 1 else None
spot = Spot(source="APRS-IS", spot = Spot(source="APRS-IS",