callsign map working

This commit is contained in:
Graham McIntire 2025-06-21 13:51:04 -05:00
parent b60c554f80
commit 24b8627fd0
No known key found for this signature in database
2 changed files with 21 additions and 6 deletions

View file

@ -48,7 +48,6 @@ export class TrailManager {
if (!trailState) { if (!trailState) {
trailState = { positions: [] }; trailState = { positions: [] };
this.trails.set(baseCallsign, trailState); this.trails.set(baseCallsign, trailState);
console.log(`TrailManager: Created new trail for ${baseCallsign}`);
} }
// Check if this position already exists (avoid duplicates) // Check if this position already exists (avoid duplicates)
@ -124,10 +123,6 @@ export class TrailManager {
className: "historical-trail-line", className: "historical-trail-line",
}).addTo(this.trailLayer); }).addTo(this.trailLayer);
console.log(
`TrailManager: Created trail line for ${baseCallsign} with ${trailState.positions.length} positions`,
);
// Don't create additional dots here since historical positions are now shown as markers // Don't create additional dots here since historical positions are now shown as markers
trailState.dots = []; trailState.dots = [];
} }

View file

@ -946,7 +946,7 @@ defmodule AprsWeb.MapLive.CallsignView do
"data_type" => to_string(Map.get(packet, :data_type, Map.get(packet, "data_type", "unknown"))), "data_type" => to_string(Map.get(packet, :data_type, Map.get(packet, "data_type", "unknown"))),
"path" => Map.get(packet, :path, Map.get(packet, "path", "")), "path" => Map.get(packet, :path, Map.get(packet, "path", "")),
"comment" => comment, "comment" => comment,
"data_extended" => data_extended || %{}, "data_extended" => convert_tuples_to_strings(data_extended || %{}),
"symbol_table_id" => symbol_table_id, "symbol_table_id" => symbol_table_id,
"symbol_code" => symbol_code, "symbol_code" => symbol_code,
"symbol_description" => symbol_description, "symbol_description" => symbol_description,
@ -998,6 +998,26 @@ defmodule AprsWeb.MapLive.CallsignView do
end end
end end
defp convert_tuples_to_strings(map) when is_map(map) do
if Map.has_key?(map, :__struct__) do
map
else
Map.new(map, fn {k, v} ->
{k, convert_tuples_to_strings(v)}
end)
end
end
defp convert_tuples_to_strings(list) when is_list(list) do
Enum.map(list, &convert_tuples_to_strings/1)
end
defp convert_tuples_to_strings(tuple) when is_tuple(tuple) do
to_string(inspect(tuple))
end
defp convert_tuples_to_strings(other), do: other
defp load_callsign_packets(socket, callsign) do defp load_callsign_packets(socket, callsign) do
# Load only the latest packet for this specific callsign # Load only the latest packet for this specific callsign
latest_packet = latest_packet =