Show actual missing data counts instead of queued flags on backfill page

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

View file

@ -85,15 +85,37 @@ defmodule MicrowavepropWeb.BackfillLive do
end
defp count_unprocessed do
Repo.one(
from(c in Contact,
where:
not is_nil(c.pos1) and
(c.hrrr_queued == false or c.weather_queued == false or
c.terrain_queued == false or c.iemre_queued == false),
select: count(c.id)
missing_terrain =
Repo.one(
from(c in Contact,
left_join: t in Microwaveprop.Terrain.TerrainProfile, on: t.qso_id == c.id,
where: not is_nil(c.pos1) and not is_nil(c.pos2) and is_nil(t.id),
select: count(c.id)
)
)
)
missing_hrrr =
Repo.one(
from(c in Contact,
where: not is_nil(c.pos1) and c.hrrr_queued == false,
select: count(c.id)
)
)
missing_weather =
Repo.one(
from(c in Contact,
where: not is_nil(c.pos1) and c.weather_queued == false,
select: count(c.id)
)
)
%{
terrain: missing_terrain,
hrrr: missing_hrrr,
weather: missing_weather,
total: max(missing_terrain, max(missing_hrrr, missing_weather))
}
end
defp fetch_stats do
@ -148,15 +170,20 @@ defmodule MicrowavepropWeb.BackfillLive do
<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="text-xs opacity-60">Enrichment Progress</div>
<div class="text-2xl font-bold">{@unprocessed} remaining</div>
<div class="text-2xl font-bold">{@unprocessed.total} remaining</div>
<div class="text-xs opacity-60 mt-1">
{@total_contacts - @unprocessed} / {@total_contacts} complete
{@total_contacts - @unprocessed.total} / {@total_contacts} complete
</div>
<progress
class="progress progress-primary w-full mt-2"
value={@total_contacts - @unprocessed}
value={@total_contacts - @unprocessed.total}
max={@total_contacts}
/>
<div class="flex gap-4 mt-2 text-xs opacity-60">
<span>Terrain: {@unprocessed.terrain}</span>
<span>HRRR: {@unprocessed.hrrr}</span>
<span>Weather: {@unprocessed.weather}</span>
</div>
</div>
<div class="stat bg-base-200 rounded-box p-4">
<div class="text-xs opacity-60">Active/Queued Jobs</div>