import logging import db logger = logging.getLogger(__name__) def get_weekly_report_text(chat_id: int): """ Generate a formatted performance report for a group. """ stats = db.get_weekly_stats(chat_id) total = stats["total"] correct = stats["correct"] if total == 0: return "📊 *Weekly Performance Report*\\n\\nNo participation data recorded for this week yet. Start voting to see stats!" accuracy = (correct / total * 100) if total > 0 else 0 report = ( f"📊 *Weekly Performance Report*\\n\\n" f"✅ Total Questions Answered: *{total}*\\n" f"🎯 Correct Answers: *{correct}*\\n" f"📈 Overall Accuracy: *{accuracy:.1f}%*\\n\\n" f"🔥 *Engagement Insights:*\\n" f"Your community is actively learning! Keep practicing to improve these stats.\\n\\n" f"_CLQuizMaster AI Analytics_" ) return report