diff --git a/lib/aprs/is/is.ex b/lib/aprs/is/is.ex index 72f5671..b6de907 100644 --- a/lib/aprs/is/is.ex +++ b/lib/aprs/is/is.ex @@ -469,8 +469,7 @@ defmodule Aprs.Is do converted_map = struct |> Map.from_struct() - |> Enum.map(fn {k, v} -> {k, struct_to_map(v)} end) - |> Enum.into(%{}) + |> Map.new(fn {k, v} -> {k, struct_to_map(v)} end) # Add type information to help with later processing Map.put(converted_map, :__original_struct__, struct_type) diff --git a/lib/aprs/packet.ex b/lib/aprs/packet.ex index 505abf8..9c5c9a8 100644 --- a/lib/aprs/packet.ex +++ b/lib/aprs/packet.ex @@ -5,6 +5,7 @@ defmodule Aprs.Packet do import Ecto.Changeset alias Aprs.DataExtended + alias Parser.Types.MicE schema "packets" do field(:base_callsign, :string) @@ -158,13 +159,13 @@ defmodule Aprs.Packet do # Extract data based on the type of data_extended additional_data = case data_extended do - %{__original_struct__: Parser.Types.MicE} = mic_e_map -> + %{__original_struct__: MicE} = mic_e_map -> extract_from_mic_e_map(mic_e_map) %{} when is_map(data_extended) -> extract_from_map(data_extended) - %Parser.Types.MicE{} = mic_e -> + %MicE{} = mic_e -> extract_from_mic_e(mic_e) _ -> @@ -210,8 +211,10 @@ defmodule Aprs.Packet do |> maybe_put(:equipment_type, mic_e.equipment_type) |> maybe_put(:course, mic_e.course) |> maybe_put(:speed, mic_e.speed) - |> maybe_put(:symbol_code, ">") # Default car symbol for MicE - |> maybe_put(:symbol_table_id, "/") # Primary table + # Default car symbol for MicE + |> maybe_put(:symbol_code, ">") + # Primary table + |> maybe_put(:symbol_table_id, "/") end # Extract data from converted MicE map (from struct_to_map conversion) @@ -222,8 +225,10 @@ defmodule Aprs.Packet do |> maybe_put(:equipment_type, mic_e_map[:equipment_type]) |> maybe_put(:course, mic_e_map[:heading]) |> maybe_put(:speed, mic_e_map[:speed]) - |> maybe_put(:symbol_code, ">") # Default car symbol for MicE - |> maybe_put(:symbol_table_id, "/") # Primary table + # Default car symbol for MicE + |> maybe_put(:symbol_code, ">") + # Primary table + |> maybe_put(:symbol_table_id, "/") end # Extract weather data from various formats diff --git a/lib/aprs_web/controllers/page_html/map.html.heex b/lib/aprs_web/controllers/page_html/map.html.heex index c12b3a8..b43bfd0 100644 --- a/lib/aprs_web/controllers/page_html/map.html.heex +++ b/lib/aprs_web/controllers/page_html/map.html.heex @@ -3,8 +3,10 @@
This is the legacy JavaScript-based map. - Try the new LiveView-based map or - enhanced version. + + Try the new LiveView-based map + + or enhanced version.
diff --git a/lib/aprs_web/helpers/aprs_symbols.ex b/lib/aprs_web/helpers/aprs_symbols.ex index f06b934..3e1cc40 100644 --- a/lib/aprs_web/helpers/aprs_symbols.ex +++ b/lib/aprs_web/helpers/aprs_symbols.ex @@ -26,7 +26,8 @@ defmodule AprsWeb.Helpers.AprsSymbols do case symbol_table_id do "/" -> "aprs-symbols-24-0.png" "\\" -> "aprs-symbols-24-1.png" - _ -> "aprs-symbols-24-0.png" # Default to primary table + # Default to primary table + _ -> "aprs-symbols-24-0.png" end end @@ -96,9 +97,9 @@ defmodule AprsWeb.Helpers.AprsSymbols do {x, y} = get_symbol_position(symbol_code) "background-image: url('/aprs-symbols/#{sprite_file}'); " <> - "background-position: #{x}px #{y}px; " <> - "width: 24px; height: 24px; " <> - "background-repeat: no-repeat;" + "background-position: #{x}px #{y}px; " <> + "width: 24px; height: 24px; " <> + "background-repeat: no-repeat;" end @doc """ @@ -109,7 +110,7 @@ defmodule AprsWeb.Helpers.AprsSymbols do extra_style = Keyword.get(opts, :style, "") base_style = symbol_css_style(symbol_table_id, symbol_code) - full_style = if extra_style != "", do: base_style <> " " <> extra_style, else: base_style + full_style = if extra_style == "", do: base_style, else: base_style <> " " <> extra_style Phoenix.HTML.raw(~s()) end @@ -137,7 +138,8 @@ defmodule AprsWeb.Helpers.AprsSymbols do Get the default symbol for unknown or invalid symbols. """ def default_symbol do - {"/", ">"} # Car icon as default + # Car icon as default + {"/", ">"} end @doc """ @@ -148,6 +150,7 @@ defmodule AprsWeb.Helpers.AprsSymbols do {table, code} when table in ["/", "\\"] and is_binary(code) and byte_size(code) > 0 -> char_code = code |> String.first() |> String.to_charlist() |> List.first() char_code >= 32 and char_code <= 127 + _ -> false end diff --git a/lib/aprs_web/live/map_live/enhanced.ex b/lib/aprs_web/live/map_live/enhanced.ex index c0e1681..ab858c8 100644 --- a/lib/aprs_web/live/map_live/enhanced.ex +++ b/lib/aprs_web/live/map_live/enhanced.ex @@ -262,12 +262,8 @@ defmodule AprsWeb.MapLive.Enhanced do .historical-marker { opacity: 0.7; } - - - -