From fa5fabe02e8627b603cce29cc7dad1ce47fdd81a Mon Sep 17 00:00:00 2001 From: Graham McIntire Date: Thu, 2 Apr 2026 11:55:01 -0500 Subject: [PATCH] Fix stat card dotted border, use job queue counts for progress --- lib/microwaveprop_web/live/backfill_live.ex | 34 ++++++++++++--------- 1 file changed, 20 insertions(+), 14 deletions(-) diff --git a/lib/microwaveprop_web/live/backfill_live.ex b/lib/microwaveprop_web/live/backfill_live.ex index 084298de..67021018 100644 --- a/lib/microwaveprop_web/live/backfill_live.ex +++ b/lib/microwaveprop_web/live/backfill_live.ex @@ -94,27 +94,33 @@ defmodule MicrowavepropWeb.BackfillLive do ) ) - missing_hrrr = + # Use Oban job counts as proxy for in-progress work since queued flags + # only indicate "was enqueued" not "data exists" + pending_hrrr = Repo.one( - from(c in Contact, - where: not is_nil(c.pos1) and c.hrrr_queued == false, - select: count(c.id) + from(j in "oban_jobs", + where: + j.worker == "Microwaveprop.Workers.HrrrFetchWorker" and + j.state in ["available", "executing", "scheduled", "retryable"], + select: count(j.id) ) ) - missing_weather = + pending_weather = Repo.one( - from(c in Contact, - where: not is_nil(c.pos1) and c.weather_queued == false, - select: count(c.id) + from(j in "oban_jobs", + where: + j.worker == "Microwaveprop.Workers.WeatherFetchWorker" and + j.state in ["available", "executing", "scheduled", "retryable"], + select: count(j.id) ) ) %{ terrain: missing_terrain, - hrrr: missing_hrrr, - weather: missing_weather, - total: max(missing_terrain, max(missing_hrrr, missing_weather)) + hrrr: pending_hrrr, + weather: pending_weather, + total: missing_terrain + pending_hrrr + pending_weather } end @@ -168,7 +174,7 @@ defmodule MicrowavepropWeb.BackfillLive do
-
+
Enrichment Progress
{@unprocessed.total} remaining
@@ -185,13 +191,13 @@ defmodule MicrowavepropWeb.BackfillLive do Weather: {@unprocessed.weather}
-
+
Active/Queued Jobs
{Enum.reduce(@stats.by_worker, 0, fn w, acc -> acc + w.total end)}
-
+
Completed (last hour)
{@stats.completed_1h}