Allow retry of unavailable enrichment on page load
This commit is contained in:
parent
45026437da
commit
f9c6e3730a
1 changed files with 3 additions and 4 deletions
|
|
@ -200,7 +200,7 @@ defmodule MicrowavepropWeb.ContactLive.Show do
|
||||||
|
|
||||||
%{contact | weather_status: :complete}
|
%{contact | weather_status: :complete}
|
||||||
|
|
||||||
contact.pos1 && contact.weather_status not in [:queued, :unavailable] ->
|
contact.pos1 && contact.weather_status != :queued ->
|
||||||
jobs = ContactWeatherEnqueueWorker.build_weather_jobs([contact])
|
jobs = ContactWeatherEnqueueWorker.build_weather_jobs([contact])
|
||||||
|
|
||||||
if jobs != [] do
|
if jobs != [] do
|
||||||
|
|
@ -208,7 +208,6 @@ defmodule MicrowavepropWeb.ContactLive.Show do
|
||||||
Radio.set_enrichment_status!([contact.id], :weather_status, :queued)
|
Radio.set_enrichment_status!([contact.id], :weather_status, :queued)
|
||||||
%{contact | weather_status: :queued}
|
%{contact | weather_status: :queued}
|
||||||
else
|
else
|
||||||
Radio.set_enrichment_status!([contact.id], :weather_status, :unavailable)
|
|
||||||
%{contact | weather_status: :unavailable}
|
%{contact | weather_status: :unavailable}
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
@ -301,7 +300,7 @@ defmodule MicrowavepropWeb.ContactLive.Show do
|
||||||
|
|
||||||
defp maybe_enqueue_terrain(nil, contact) do
|
defp maybe_enqueue_terrain(nil, contact) do
|
||||||
cond do
|
cond do
|
||||||
contact.pos1 && contact.pos2 && contact.terrain_status not in [:queued, :unavailable] ->
|
contact.pos1 && contact.pos2 && contact.terrain_status != :queued ->
|
||||||
case Oban.insert(TerrainProfileWorker.new(%{"contact_id" => contact.id})) do
|
case Oban.insert(TerrainProfileWorker.new(%{"contact_id" => contact.id})) do
|
||||||
{:ok, %{conflict?: false}} ->
|
{:ok, %{conflict?: false}} ->
|
||||||
Radio.set_enrichment_status!([contact.id], :terrain_status, :queued)
|
Radio.set_enrichment_status!([contact.id], :terrain_status, :queued)
|
||||||
|
|
@ -331,7 +330,7 @@ defmodule MicrowavepropWeb.ContactLive.Show do
|
||||||
lat = contact.pos1 && contact.pos1["lat"]
|
lat = contact.pos1 && contact.pos1["lat"]
|
||||||
lon = contact.pos1 && (contact.pos1["lon"] || contact.pos1["lng"])
|
lon = contact.pos1 && (contact.pos1["lon"] || contact.pos1["lng"])
|
||||||
|
|
||||||
if lat && lon && contact.hrrr_status not in [:queued, :unavailable] do
|
if lat && lon && contact.hrrr_status != :queued do
|
||||||
valid_time = HrrrClient.nearest_hrrr_hour(contact.qso_timestamp)
|
valid_time = HrrrClient.nearest_hrrr_hour(contact.qso_timestamp)
|
||||||
{rlat, rlon} = Weather.round_to_hrrr_grid(lat, lon)
|
{rlat, rlon} = Weather.round_to_hrrr_grid(lat, lon)
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue