map debug + coord backfill, remove email channel, countdown label

- Surface "X/Y passende Wohnungen mit Koordinaten" on the Karte view +
  admin-only "Koordinaten nachladen" button (POST /actions/backfill-coords)
  that geocodes missing flats via Google Maps directly from the web container
- Add googlemaps dep + GMAPS_API_KEY env to web service
- Light console.log in map.js ("rendering N/M markers", "building Leaflet…")
  so the browser DevTools shows what's happening
- Drop e-mail channel from notifications UI, notify dispatcher, and _alert_status;
  coerce legacy 'email' channel rows back to 'ui' on save
- Countdown said "Aktualisierung läuft…" next to "nächste Aktualisierung" →
  shortened to "aktualisiere…"

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
EiSiMo 2026-04-21 13:42:21 +02:00
parent 51b6b02b24
commit 0c58242ce7
11 changed files with 149 additions and 58 deletions

View file

@ -439,6 +439,35 @@ def get_flat(flat_id: str) -> Optional[sqlite3.Row]:
return _conn.execute("SELECT * FROM flats WHERE id = ?", (flat_id,)).fetchone()
def flats_missing_coords(limit: int = 500) -> list[sqlite3.Row]:
return list(_conn.execute(
"""SELECT id, address FROM flats
WHERE (lat IS NULL OR lng IS NULL) AND address IS NOT NULL AND address != ''
ORDER BY discovered_at DESC LIMIT ?""",
(limit,),
).fetchall())
def set_flat_coords(flat_id: str, lat: float, lng: float) -> None:
with _lock:
_conn.execute(
"UPDATE flats SET lat = ?, lng = ? WHERE id = ?",
(lat, lng, flat_id),
)
def count_flats_coords() -> tuple[int, int]:
"""Return (total_flats, with_coords)."""
row = _conn.execute(
"SELECT COUNT(*) AS total, "
" SUM(CASE WHEN lat IS NOT NULL AND lng IS NOT NULL THEN 1 ELSE 0 END) AS geo "
"FROM flats"
).fetchone()
total = int(row["total"] or 0)
geo = int(row["geo"] or 0)
return total, geo
# ---------------------------------------------------------------------------
# Applications
# ---------------------------------------------------------------------------