Feature: Generische Seiten-Hilfe (UI.pageInfo), POI Multi-Select, Tagessprüche-DB (SW by-v654)
- UI.pageInfo(): generische Hilfe-Funktion — erstes Öffnen zeigt Info-Banner, danach ? Button oben rechts; CSS-Klassen pinfo-* - Übungen-Seite nutzt UI.pageInfo() als erstes Beispiel - Karte POI: Mehrfachauswahl (außer Giftköder), Kombi-Typen entfernt, type als comma-separated im Backend - daily_quotes Tabelle in DB (346 Einträge via import_quotes.py importiert) - GET /widget/quote — deterministischer Tagesspruch (wechselt täglich)
This commit is contained in:
parent
1fdba57365
commit
9103c7950f
12 changed files with 623 additions and 38 deletions
24
scripts/import_quotes.py
Normal file
24
scripts/import_quotes.py
Normal file
|
|
@ -0,0 +1,24 @@
|
|||
#!/usr/bin/env python3
|
||||
"""Importiert dog_quotes.json in die daily_quotes-Tabelle."""
|
||||
import json, sqlite3, sys
|
||||
from pathlib import Path
|
||||
|
||||
DB_PATH = Path(__file__).parent.parent / 'backend' / 'banyaro.db'
|
||||
JSON_PATH = Path(__file__).parent / 'dog_quotes.json'
|
||||
|
||||
quotes = json.loads(JSON_PATH.read_text())
|
||||
conn = sqlite3.connect(DB_PATH)
|
||||
|
||||
existing = conn.execute("SELECT COUNT(*) FROM daily_quotes").fetchone()[0]
|
||||
if existing > 0:
|
||||
print(f"{existing} Einträge bereits vorhanden — überspringe Import.")
|
||||
print("Zum Neuimport: DELETE FROM daily_quotes; zuerst ausführen.")
|
||||
sys.exit(0)
|
||||
|
||||
conn.executemany(
|
||||
"INSERT INTO daily_quotes (text, autor, kategorie) VALUES (?, ?, ?)",
|
||||
[(q['text'], q.get('autor'), q.get('kategorie')) for q in quotes]
|
||||
)
|
||||
conn.commit()
|
||||
print(f"{len(quotes)} Tagessprüche importiert.")
|
||||
conn.close()
|
||||
Loading…
Add table
Add a link
Reference in a new issue