diff --git a/lib/microwaveprop_web/live/rover_live.ex b/lib/microwaveprop_web/live/rover_live.ex index 9f0ba6d5..9cf0d2d6 100644 --- a/lib/microwaveprop_web/live/rover_live.ex +++ b/lib/microwaveprop_web/live/rover_live.ex @@ -1,7 +1,7 @@ defmodule MicrowavepropWeb.RoverLive do @moduledoc """ Rover-planning page: enter the fixed stations you want to work, pick a - band/mode/forecast hour, and the map paints a smoothed propagation + band and forecast hour, and the map paints a smoothed propagation quality heatmap with the top 5 ranked drive-to candidates pinned in the bottom strip. """ @@ -10,7 +10,6 @@ defmodule MicrowavepropWeb.RoverLive do alias Microwaveprop.Accounts.User alias Microwaveprop.Propagation - alias Microwaveprop.Propagation.ModeThresholds alias Microwaveprop.Radio.Maidenhead alias Microwaveprop.Repo alias Microwaveprop.Rover @@ -119,10 +118,6 @@ defmodule MicrowavepropWeb.RoverLive do {:noreply, assign(socket, band: band)} end - def handle_event("select_mode", %{"mode" => mode_str}, socket) do - {:noreply, assign(socket, mode: parse_mode(mode_str, socket.assigns.mode))} - end - def handle_event("set_forecast_hour", %{"value" => v}, socket) do hour = v |> parse_int(@default_forecast_hour) |> clamp(0, 18) {:noreply, assign(socket, forecast_hour: hour)} @@ -471,28 +466,12 @@ defmodule MicrowavepropWeb.RoverLive do end end - defp parse_mode(mode_str, fallback) do - case mode_str do - "ssb" -> :ssb - "cw" -> :cw - "q65_60a" -> :q65_60a - "q65_120b" -> :q65_120b - _ -> fallback - end - end - defp clamp(v, lo, hi), do: v |> max(lo) |> min(hi) defp band_label(band) do Enum.find_value(@bands, "#{band} MHz", fn b -> if b.value == band, do: b.label end) end - defp mode_label(mode) do - Enum.find_value(ModeThresholds.modes(), "#{mode}", fn {atom, label} -> - if atom == mode, do: label - end) - end - defp station_id(%{id: id}), do: to_string(id) defp station_id(_), do: nil @@ -501,244 +480,223 @@ defmodule MicrowavepropWeb.RoverLive do @impl true def render(assigns) do ~H""" - -
-
-
- Rover planning - - {band_label(@band)} · {mode_label(@mode)} · Forecast +{@forecast_hour}h - -
- +
+ +
+
+
- - {if @scoring_loading, do: "Calculating…", else: "Calculate"} - - +
-
-
-
-
- -
- - +
""" end diff --git a/test/microwaveprop/rover/compute_test.exs b/test/microwaveprop/rover/compute_test.exs index bfff6cab..abf4c521 100644 --- a/test/microwaveprop/rover/compute_test.exs +++ b/test/microwaveprop/rover/compute_test.exs @@ -40,7 +40,7 @@ defmodule Microwaveprop.Rover.ComputeTest do assert is_list(result.cells) assert length(result.top_candidates) <= 5 - assert length(result.top_candidates) > 0 + refute result.top_candidates == [] # Sorted by score desc. scores = Enum.map(result.top_candidates, & &1.score) diff --git a/test/microwaveprop_web/live/rover_live_test.exs b/test/microwaveprop_web/live/rover_live_test.exs index 3bf37101..1f2e0c8d 100644 --- a/test/microwaveprop_web/live/rover_live_test.exs +++ b/test/microwaveprop_web/live/rover_live_test.exs @@ -14,15 +14,15 @@ defmodule MicrowavepropWeb.RoverLiveTest do assert html =~ "Calculate" end - test "shows the right-docked sidebar with the six configured sections", %{conn: conn} do + test "shows the right-docked sidebar with the configured sections", %{conn: conn} do {:ok, _view, html} = live(conn, ~p"/rover") assert html =~ ~s(id="rover-sidebar") assert html =~ "FIXED STATIONS" assert html =~ "FORECAST HOUR" assert html =~ "BAND" - assert html =~ "MODE" assert html =~ "MAX DRIVE TIME" assert html =~ "MIN ELEV GAIN" + refute html =~ ">MODE<" end test "displays the three default NTMS stations", %{conn: conn} do