diff --git a/app.py b/app.py index 0054143..1a78c28 100644 --- a/app.py +++ b/app.py @@ -440,7 +440,8 @@ def triage_submission(db, submission_id: int) -> dict: db.execute( """UPDATE submissions SET triage_tier=?, triage_reasons=?, triage_at=CURRENT_TIMESTAMP, - public=?, status=?, display_text=? + public=?, status=?, display_text=?, + published_at=CASE WHEN ? = 1 THEN COALESCE(published_at, CURRENT_TIMESTAMP) ELSE published_at END WHERE id=?""", ( tier, @@ -448,6 +449,7 @@ def triage_submission(db, submission_id: int) -> dict: 1 if tier == 1 else 0, "published" if tier == 1 else ("blocked" if tier == 3 else "pending"), display_text, + tier, submission_id, ), ) @@ -481,7 +483,7 @@ def _run_triage_async(submission_id: int): import time as _time import sqlite3 as _sqlite3 - THREAD_WINDOW_SEC = 360 # 6 Minuten (5 Min Thread-Window + 1 Min Puffer) + THREAD_WINDOW_SEC = int(os.environ.get("TRIAGE_DELAY_SECONDS", "360")) # default: 6 Min print(f"[triage] #{submission_id} geplant in {THREAD_WINDOW_SEC}s", file=sys.stderr) _time.sleep(THREAD_WINDOW_SEC) @@ -1316,6 +1318,8 @@ def admin_dashboard(): reasons = json.loads(r["triage_reasons"] or "[]") tooltip = " | ".join(reasons) if reasons else "Keine Details" triage_badge = f'{emoji}' + else: + triage_badge = '' table_rows += f""" @@ -1338,8 +1342,17 @@ def admin_dashboard(): content_snippet = (r["content"] or "")[:80] media_icon = {"image": "🖼️", "audio": "🎤", "video": "🎬", "document": "📎"}.get(r["type"], "") st_label = status_names.get(r["status"], r["status"]) + # Triage badge for mobile + triage_mobile = "" + if r["triage_tier"]: + emoji = triage_emoji.get(r["triage_tier"], "⚪") + reasons = json.loads(r["triage_reasons"] or "[]") + tooltip = " | ".join(reasons) if reasons else "" + triage_mobile = f'{emoji}' + else: + triage_mobile = '' mobile_cards += f""" -
#{r['id']}{st_label}
+
#{r['id']}{triage_mobile}{st_label}
{media_icon} {r['type']} · {r['channel']}
{'📍 ' + r['halle'] if r['halle'] else ''}{' 🎯 ' + r['spiel_titel'] if r['spiel_titel'] else ''}
{content_snippet}