Spaces:
Sleeping
Sleeping
Download analytics.py from H3y-sam/Cl_QuizMaster: direct link, hf CLI and curl.
- Browser
- Download file 923 Bytes
-
https://huggingface.co/spaces/H3y-sam/Cl_QuizMaster/resolve/main/analytics.py
- Command line
-
hf download hf://spaces/H3y-sam/Cl_QuizMaster/analytics.py
-
curl -L -o analytics.py https://huggingface.co/spaces/H3y-sam/Cl_QuizMaster/resolve/main/analytics.py
923 Bytes
| 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 | |