Feature: Filme-Suche, HdM ins Forum + Gewinner-Badge im Profil, SW by-v594
- Filme-Seite: Suchfeld (filtert live nach Titel, Rasse, Genre, Beschreibung)
- Filme-Seite: Tab "Hund des Monats" entfernt
- Forum: kompakte HdM-Kachel über der Suche (Sieger + Stimmen), Klick öffnet Abstimmungs-Modal
- Hundeprofil: goldene Badges für jeden gewonnenen Monat (🏆 Mai 2026 …)
- DB: Tabelle hund_des_monats_wins (dauerhaft, dog_id + monat + stimmen)
- Scheduler: Job am 1. des Monats 00:05 — schreibt Vormonats-Sieger, Push an Besitzer
- Dogs-API: liefert hdm_wins[] pro Hund mit
This commit is contained in:
parent
d00284184b
commit
ea2a83b29e
9 changed files with 348 additions and 7 deletions
|
|
@ -75,6 +75,21 @@ async def list_dogs(user=Depends(get_current_user)):
|
|||
d = dict(r)
|
||||
d["is_guest"] = True
|
||||
result.append(d)
|
||||
|
||||
# HdM-Siege pro Hund anhängen
|
||||
if result:
|
||||
dog_ids = [d["id"] for d in result]
|
||||
with db() as conn:
|
||||
wins_rows = conn.execute(
|
||||
f"SELECT dog_id, monat FROM hund_des_monats_wins WHERE dog_id IN ({','.join('?'*len(dog_ids))}) ORDER BY monat DESC",
|
||||
dog_ids,
|
||||
).fetchall()
|
||||
wins_map: dict[int, list[str]] = {}
|
||||
for w in wins_rows:
|
||||
wins_map.setdefault(w["dog_id"], []).append(w["monat"])
|
||||
for d in result:
|
||||
d["hdm_wins"] = wins_map.get(d["id"], [])
|
||||
|
||||
return result
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue