fix(fuenfvoacht): Nachmittags-Reminder prüft alle Slots statt nur Hauptslot
job_reminder_afternoon prüfte nur channel.post_time (19:55), Artikel auf anderen Zeitslots (z.B. 19:45) wurden als fehlend gemeldet. Jetzt werden alle approved/scheduled Artikel des Tages geprüft. Made-with: Cursor
This commit is contained in:
parent
55a6ceedd0
commit
abea089432
1 changed files with 15 additions and 20 deletions
|
|
@ -251,23 +251,19 @@ async def job_post_articles(bot: Bot):
|
|||
|
||||
|
||||
async def job_check_notify(bot: Bot):
|
||||
"""Prüft alle 5 Min ob scheduled-Artikel zur Bot-Benachrichtigung fällig sind."""
|
||||
"""Prüft alle 5 Min ob scheduled-Artikel fällig sind → direkt approved setzen."""
|
||||
due = db.get_due_notifications()
|
||||
for article in due:
|
||||
d = article['date']
|
||||
pt = article['post_time']
|
||||
text = (
|
||||
f"📋 <b>Review: {d} · {pt} Uhr</b>\n"
|
||||
f"Version {article['version']}\n"
|
||||
f"──────────────────────\n\n"
|
||||
f"{article['content_final']}\n\n"
|
||||
f"──────────────────────\n"
|
||||
f"Freigeben oder bearbeiten?"
|
||||
db.update_article_status(d, 'approved', post_time=pt)
|
||||
await notify_reviewers(
|
||||
bot,
|
||||
f"📅 <b>Artikel eingeplant</b>\n\n"
|
||||
f"📆 {d} um <b>{pt} Uhr</b>\n"
|
||||
f"Wird automatisch gepostet."
|
||||
)
|
||||
await notify_reviewers(bot, text,
|
||||
reply_markup=review_keyboard(d, pt))
|
||||
db.update_article_status(d, 'sent_to_bot', post_time=pt)
|
||||
flog.article_sent_to_bot(d, pt, db.get_reviewer_chat_ids())
|
||||
flog.info('article_auto_approved', date=d, post_time=pt)
|
||||
|
||||
|
||||
async def job_morning_briefing(bot: Bot):
|
||||
|
|
@ -330,17 +326,16 @@ async def job_cleanup_db():
|
|||
|
||||
|
||||
async def job_reminder_afternoon(bot: Bot):
|
||||
"""Nachmittags-Reminder wenn Hauptslot noch nicht freigegeben."""
|
||||
"""Nachmittags-Reminder wenn kein Artikel eingeplant ist."""
|
||||
d = today_str()
|
||||
channel = db.get_channel()
|
||||
post_t = channel.get('post_time', POST_TIME)
|
||||
art = db.get_article_by_date(d, post_t)
|
||||
if art and art['status'] in ('sent_to_bot', 'pending_review', 'draft', 'scheduled'):
|
||||
articles_today = db.get_articles_by_date(d)
|
||||
approved_today = [a for a in articles_today if a['status'] in ('approved', 'scheduled', 'sent_to_bot')]
|
||||
if not approved_today:
|
||||
await notify_reviewers(
|
||||
bot,
|
||||
f"⚠️ <b>Noch nicht freigegeben!</b>\n\n"
|
||||
f"Posting um {post_t} Uhr — bitte jetzt freigeben.",
|
||||
reply_markup=review_keyboard(d, post_t) if art['status'] == 'sent_to_bot' else None
|
||||
f"⚠️ <b>Noch kein Artikel eingeplant!</b>\n\n"
|
||||
f"Für heute ({d}) ist kein freigegebener Artikel vorhanden.\n"
|
||||
f"👉 Dashboard: http://100.73.171.62:8080"
|
||||
)
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue