- Rename beacons.height_m to height_ft; migration converts existing values (m * 3.28084). Form/list/show labels updated. - Beacon changeset now fills lat/lon from the grid when they're blank (previously only the reverse worked). Lat/lon and grid inputs are no longer marked required in the form — enter one side and the other populates on blur via phx-change.
23 lines
505 B
Elixir
23 lines
505 B
Elixir
defmodule Microwaveprop.BeaconsFixtures do
|
|
@moduledoc """
|
|
Test helpers for creating beacon records.
|
|
"""
|
|
|
|
alias Microwaveprop.Beacons
|
|
|
|
def valid_beacon_attrs(attrs \\ %{}) do
|
|
Enum.into(attrs, %{
|
|
frequency_mhz: 10_368.1,
|
|
callsign: "W5HN",
|
|
lat: 32.897,
|
|
lon: -97.038,
|
|
power_mw: 10_000.0,
|
|
height_ft: 100.0
|
|
})
|
|
end
|
|
|
|
def beacon_fixture(user, attrs \\ %{}) do
|
|
{:ok, beacon} = Beacons.create_beacon(user, valid_beacon_attrs(attrs))
|
|
beacon
|
|
end
|
|
end
|