Fix stat card dotted border, use job queue counts for progress

This commit is contained in:
Graham McIntire 2026-04-02 11:55:01 -05:00
parent 4999548a0c
commit fa5fabe02e
No known key found for this signature in database
GPG key ID: F4ABF488E6029E59

View file

@ -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
</.header>
<div class="grid grid-cols-1 md:grid-cols-3 gap-4 my-6">
<div class="stat bg-base-200 rounded-box p-4">
<div class="bg-base-200 rounded-box p-4">
<div class="text-xs opacity-60">Enrichment Progress</div>
<div class="text-2xl font-bold">{@unprocessed.total} remaining</div>
<div class="text-xs opacity-60 mt-1">
@ -185,13 +191,13 @@ defmodule MicrowavepropWeb.BackfillLive do
<span>Weather: {@unprocessed.weather}</span>
</div>
</div>
<div class="stat bg-base-200 rounded-box p-4">
<div class="bg-base-200 rounded-box p-4">
<div class="text-xs opacity-60">Active/Queued Jobs</div>
<div class="text-2xl font-bold">
{Enum.reduce(@stats.by_worker, 0, fn w, acc -> acc + w.total end)}
</div>
</div>
<div class="stat bg-base-200 rounded-box p-4">
<div class="bg-base-200 rounded-box p-4">
<div class="text-xs opacity-60">Completed (last hour)</div>
<div class="text-2xl font-bold">{@stats.completed_1h}</div>
</div>