File size: 923 Bytes
d5fa022
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
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