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):
|
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()
|
due = db.get_due_notifications()
|
||||||
for article in due:
|
for article in due:
|
||||||
d = article['date']
|
d = article['date']
|
||||||
pt = article['post_time']
|
pt = article['post_time']
|
||||||
text = (
|
db.update_article_status(d, 'approved', post_time=pt)
|
||||||
f"📋 <b>Review: {d} · {pt} Uhr</b>\n"
|
await notify_reviewers(
|
||||||
f"Version {article['version']}\n"
|
bot,
|
||||||
f"──────────────────────\n\n"
|
f"📅 <b>Artikel eingeplant</b>\n\n"
|
||||||
f"{article['content_final']}\n\n"
|
f"📆 {d} um <b>{pt} Uhr</b>\n"
|
||||||
f"──────────────────────\n"
|
f"Wird automatisch gepostet."
|
||||||
f"Freigeben oder bearbeiten?"
|
|
||||||
)
|
)
|
||||||
await notify_reviewers(bot, text,
|
flog.info('article_auto_approved', date=d, post_time=pt)
|
||||||
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())
|
|
||||||
|
|
||||||
|
|
||||||
async def job_morning_briefing(bot: Bot):
|
async def job_morning_briefing(bot: Bot):
|
||||||
|
|
@ -330,17 +326,16 @@ async def job_cleanup_db():
|
||||||
|
|
||||||
|
|
||||||
async def job_reminder_afternoon(bot: Bot):
|
async def job_reminder_afternoon(bot: Bot):
|
||||||
"""Nachmittags-Reminder wenn Hauptslot noch nicht freigegeben."""
|
"""Nachmittags-Reminder wenn kein Artikel eingeplant ist."""
|
||||||
d = today_str()
|
d = today_str()
|
||||||
channel = db.get_channel()
|
articles_today = db.get_articles_by_date(d)
|
||||||
post_t = channel.get('post_time', POST_TIME)
|
approved_today = [a for a in articles_today if a['status'] in ('approved', 'scheduled', 'sent_to_bot')]
|
||||||
art = db.get_article_by_date(d, post_t)
|
if not approved_today:
|
||||||
if art and art['status'] in ('sent_to_bot', 'pending_review', 'draft', 'scheduled'):
|
|
||||||
await notify_reviewers(
|
await notify_reviewers(
|
||||||
bot,
|
bot,
|
||||||
f"⚠️ <b>Noch nicht freigegeben!</b>\n\n"
|
f"⚠️ <b>Noch kein Artikel eingeplant!</b>\n\n"
|
||||||
f"Posting um {post_t} Uhr — bitte jetzt freigeben.",
|
f"Für heute ({d}) ist kein freigegebener Artikel vorhanden.\n"
|
||||||
reply_markup=review_keyboard(d, post_t) if art['status'] == 'sent_to_bot' else None
|
f"👉 Dashboard: http://100.73.171.62:8080"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue