diff --git a/lib/microwaveprop_web/live/backfill_live.ex b/lib/microwaveprop_web/live/backfill_live.ex index c9229fa1..b695e05d 100644 --- a/lib/microwaveprop_web/live/backfill_live.ex +++ b/lib/microwaveprop_web/live/backfill_live.ex @@ -86,6 +86,9 @@ defmodule MicrowavepropWeb.BackfillLive do defp count_unprocessed do incomplete = [:pending, :queued, :processing, :failed] + done = [:complete, :unavailable] + + total = Repo.one(from(c in Contact, where: not is_nil(c.pos1), select: count())) terrain = Repo.one(from(c in Contact, where: c.terrain_status in ^incomplete and not is_nil(c.pos1), select: count())) @@ -96,11 +99,30 @@ defmodule MicrowavepropWeb.BackfillLive do weather = Repo.one(from(c in Contact, where: c.weather_status in ^incomplete and not is_nil(c.pos1), select: count())) + iemre = + Repo.one(from(c in Contact, where: c.iemre_status in ^incomplete and not is_nil(c.pos1), select: count())) + + all_done = + Repo.one( + from(c in Contact, + where: + not is_nil(c.pos1) and + c.hrrr_status in ^done and + c.weather_status in ^done and + c.terrain_status in ^done and + c.iemre_status in ^done, + select: count() + ) + ) + %{ terrain: terrain, hrrr: hrrr, weather: weather, - total: max(terrain, max(hrrr, weather)) + iemre: iemre, + remaining: max(terrain, max(hrrr, max(weather, iemre))), + complete: all_done, + total: total } end @@ -268,19 +290,20 @@ defmodule MicrowavepropWeb.BackfillLive do