From 604988e1adcc25a81f41c7828b98bb4c00850a4b Mon Sep 17 00:00:00 2001 From: Derick Date: Wed, 11 Sep 2024 20:42:06 +0800 Subject: [PATCH] Update sync_status_readme.py add feature --- sync_status_readme.py | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/sync_status_readme.py b/sync_status_readme.py index 4f18d595b8..6dc6e0c7ea 100644 --- a/sync_status_readme.py +++ b/sync_status_readme.py @@ -12,9 +12,9 @@ END_DATE = datetime.fromisoformat(os.environ.get( 'END_DATE', '2024-07-14T23:59:59+00:00')).replace(tzinfo=pytz.UTC) DEFAULT_TIMEZONE = 'Asia/Shanghai' -FILE_SUFFIX = os.environ.get('FILE_SUFFIX', '_EICL1st.md') +FILE_SUFFIX = os.environ.get('FILE_SUFFIX', '.md') README_FILE = 'README.md' -FIELD_NAME = os.environ.get('FIELD_NAME', 'EICL1st· Name') +FIELD_NAME = os.environ.get('FIELD_NAME', 'Name') Content_START_MARKER = "" Content_END_MARKER = "" TABLE_START_MARKER = "" @@ -351,6 +351,7 @@ def calculate_statistics(content): eliminated_participants = 0 completed_participants = 0 perfect_attendance_users = [] + completed_users = [] for row in rows: user_name = row.split('|')[1].strip() @@ -361,9 +362,11 @@ def calculate_statistics(content): eliminated_participants += 1 elif all(status == '✅' for status in statuses): completed_participants += 1 + completed_users.append(user_name) perfect_attendance_users.append(user_name) elif all(status in ['✅', '⭕️', ' '] for status in statuses): completed_participants += 1 + completed_users.append(user_name) elimination_rate = (eliminated_participants / total_participants) * 100 if total_participants > 0 else 0 @@ -375,7 +378,8 @@ def calculate_statistics(content): 'eliminated_participants': eliminated_participants, 'elimination_rate': elimination_rate, 'fork_count': fork_count, - 'perfect_attendance_users': perfect_attendance_users + 'perfect_attendance_users': perfect_attendance_users, + 'completed_users': completed_users } @@ -403,6 +407,7 @@ def main(): stats_content = f"\n\n## 统计数据\n\n" stats_content += f"- 总参与人数: {stats['total_participants']}\n" stats_content += f"- 完成人数: {stats['completed_participants']}\n" + stats_content += f"- 完成用户: {', '.join(stats['completed_users'])}\n" stats_content += f"- 全勤用户: {', '.join(stats['perfect_attendance_users'])}\n" stats_content += f"- 淘汰人数: {stats['eliminated_participants']}\n" stats_content += f"- 淘汰率: {stats['elimination_rate']:.2f}%\n"