From b7dc805567813b1e466d1dd7f91de37f2937485d Mon Sep 17 00:00:00 2001 From: Zcraft_ <153985444+Zcraft3793@users.noreply.github.com> Date: Wed, 1 Oct 2025 08:16:03 +0800 Subject: [PATCH 1/5] =?UTF-8?q?=E6=9B=B4=E6=96=B0=20activities=5Fv2=5Frout?= =?UTF-8?q?er.py?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- routers/activities_v2_router.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/routers/activities_v2_router.py b/routers/activities_v2_router.py index d48fe0e..4c5b91e 100644 --- a/routers/activities_v2_router.py +++ b/routers/activities_v2_router.py @@ -48,7 +48,7 @@ async def create_activity_v2( result = await db.zvms_new.get_collection("activities").insert_one(activity) log.with_text( - f'User {await get_user_name(user['id'])} (ID: {user['id']}) created activity {activity["name"]} at {datetime.now().isoformat()}. It\'s {activity["status"]} and the creator is {activity["creator"]}. The ID of the activity is {result.inserted_id}.' + f'User {await get_user_name(user['id'])} (ID: {user['id']}) created activity {activity["name"]} at {datetime.now().isoformat()}. The ID of the activity is {result.inserted_id}.' ) await log.insert_log() @@ -345,7 +345,7 @@ async def add_activity_member_v2( result = await db.zvms_new.get_collection("activity_members").insert_one(member) log.with_text( - f'User {await get_user_name(user["id"])} added member {await get_user_name(target_user.id)} to activity {target_activity.name} at {datetime.now().isoformat()}. The ID of the activity is {activity_id}.' + f'User {await get_user_name(user["id"])} added member {target_user.name} to activity {target_activity.name} at {datetime.now().isoformat()}. The ID of the activity is {activity_id}.' ) await log.insert_log() From 6eb12f95532b6235fce9baeea9b63b8876461b23 Mon Sep 17 00:00:00 2001 From: Zcraft_ <153985444+Zcraft3793@users.noreply.github.com> Date: Sat, 4 Oct 2025 16:28:28 +0800 Subject: [PATCH 2/5] Update activities_v2_router.py --- routers/activities_v2_router.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/routers/activities_v2_router.py b/routers/activities_v2_router.py index 4c5b91e..a8dc929 100644 --- a/routers/activities_v2_router.py +++ b/routers/activities_v2_router.py @@ -48,7 +48,7 @@ async def create_activity_v2( result = await db.zvms_new.get_collection("activities").insert_one(activity) log.with_text( - f'User {await get_user_name(user['id'])} (ID: {user['id']}) created activity {activity["name"]} at {datetime.now().isoformat()}. The ID of the activity is {result.inserted_id}.' + f'User {await get_user_name(user['id'])} (ID: {user['id']}) created activity {activity["name"]} at {datetime.now().isoformat()} (ID: {result.inserted_id}).' ) await log.insert_log() From 089d554ecd238971c9fc3d0706d6a34584d4bca2 Mon Sep 17 00:00:00 2001 From: Zcraft_ <153985444+Zcraft3793@users.noreply.github.com> Date: Sat, 4 Oct 2025 17:00:13 +0800 Subject: [PATCH 3/5] Update statement.py --- util/statement.py | 55 ++++------------------------------------------- 1 file changed, 4 insertions(+), 51 deletions(-) diff --git a/util/statement.py b/util/statement.py index cb79751..4227a96 100644 --- a/util/statement.py +++ b/util/statement.py @@ -35,7 +35,7 @@ TRANSLATIONS = { "zh": { "volunteer_statement": "义工明细", - "signature": "镇海中学义工管理平台 | 学生会实践部", + "signature": "镇海中学义工管理平台 | 学生会", "name": "姓名", "student_id": "学号", "class": "班级", @@ -64,7 +64,7 @@ "recording_mode": "记入模式", "duration": "计入时长", "person_in_charge": "负责人", - "sgn": "镇海中学团委 学生会实践部", + "sgn": "镇海中学团委 学生会", "stmt": "本明细由平台数据导出自动生成,经团委审核、盖章后生效。未经审核的明细不具备证明效力。", "spreadsheet": { "_id": "数据库 ID", @@ -83,7 +83,7 @@ }, "en": { "volunteer_statement": "Volunteer Details", - "signature": "Zhenhai High School Volunteer Management System | Department of Practice, Student Union", + "signature": "Zhenhai High School Volunteer Management System | Student Union", "name": "Name", "student_id": "Student ID", "class": "Class", @@ -111,7 +111,7 @@ "recording_mode": "Recording Mode", "duration": "Duration", "person_in_charge": "Person in Charge", - "sgn": "Zhenhai High School Youth League Committee & Student Union Department of Practice", + "sgn": "Zhenhai High School Youth League Committee & Student Union", "stmt": "This statement is automatically generated from platform data and is valid after review and stamping by the Youth League Committee. Unreviewed statements do not have proof of validity.", "spreadsheet": { "_id": "Database ID", @@ -128,53 +128,6 @@ "filename": "Volunteer Details Sheet", }, }, - "jp": { - "volunteer_statement": "ボランティア明細", - "signature": "鎮海中学校ボランティア管理システム | 学生会実践部", - "name": "名前", - "student_id": "学生ID", - "class": "クラス", - "database_id": "データベースID", - "export_time": "エクスポート時間", - "export_period": "エクスポート期間", - "volunteer_statistics": "ボランティア時間統計", - "volunteer_statistics_this_year": "今年のボランティア時間統計", - "category": "統計項目", - "total_hours": "総時間", - "on_campus": "校内", - "off_campus": "校外", - "social_practice": "社会実践", - "effective_hours": "有効時間", - "volunteer_hours": "ボランティア時間", - "required_hours": "必要最低時間", - "reached_target": "目標達成", - "not_reached_target": "目標未達成", - "target_status": "目標状態", - "volunteer_hours_this_year": "今年のボランティア時間", - "hours": "時間", - "volunteer_service_records": "ボランティアサービス記録詳細", - "activity_name": "活動名", - "date": "日付", - "recording_mode": "記録モード", - "duration": "サービス時間", - "person_in_charge": "担当者", - "sgn": "鎮海中学校青年団委員会 学生会実践部", - "stmt": "この明細はプラットフォームデータから自動生成され、青年団委員会の審査とスタンプ後に有効になります。未審査の明細は証明力を持ちません。", - "spreadsheet": { - "_id": "データベースID", - "name": "名前", - "id": "学生ID", - "group": "クラス", - "on-campus": "校内", - "off-campus": "校外", - "social-practice": "社会実践", - "ay-on-campus": "今年の校内", - "ay-off-campus": "今年の校外", - "ay-social-practice": "今年の社会実践", - "description": "明細", - "filename": "ボランティア明細表", - }, - }, } From a0e1a192d61fc831c1bb5d0502a9798b9abd6f88 Mon Sep 17 00:00:00 2001 From: Zcraft_ <153985444+Zcraft3793@users.noreply.github.com> Date: Sat, 4 Oct 2025 17:03:18 +0800 Subject: [PATCH 4/5] Update validation.py --- util/validation.py | 23 ----------------------- 1 file changed, 23 deletions(-) diff --git a/util/validation.py b/util/validation.py index cca35d6..283064f 100644 --- a/util/validation.py +++ b/util/validation.py @@ -3,35 +3,12 @@ def validate_activity_name(name: str): - """ - Validate activity name. - 1. Should be only appear in Chinese, Latin Characters, numbers, spaces, slashes, dashes, and dots. - 2. ASCII letters should be wrapped with spaces if inserted between Chinese characters. - 3. Should not be empty. - 4. Should not have space before or after the string. - """ if not name.strip(): return False, "Should not be empty" if name[0] == " " or name[-1] == " ": return False, "Should not have space before or after the string" - # Should only contain Chinese, Latin Characters, numbers, spaces, slashes, and dots - if not re.match(r"^[-\u4e00-\u9fa5\u2013-\u2014a-zA-Z0-9 /-/.]+$", name): - return ( - False, - "Should only appear in Chinese, Latin Characters, numbers, spaces, slashes, dashes (including en dash and em dash), and dots", - ) - - # ASCII letters should be wrapped with spaces if inserted between Chinese characters - if re.search(r"[\u4e00-\u9fa5][a-zA-Z0-9]", name) or re.search( - r"[a-zA-Z0-9][\u4e00-\u9fa5]", name - ): - return ( - False, - "ASCII letters should be wrapped with spaces if inserted between Chinese characters", - ) - return True, "" From 8b29318fb14fd6250b7c2b05f85fad5da6dfb937 Mon Sep 17 00:00:00 2001 From: Zcraft_ <153985444+Zcraft3793@users.noreply.github.com> Date: Sat, 4 Oct 2025 17:03:53 +0800 Subject: [PATCH 5/5] Update users_router.py --- routers/users_router.py | 2 -- 1 file changed, 2 deletions(-) diff --git a/routers/users_router.py b/routers/users_router.py index 4a73f6b..4d124bd 100755 --- a/routers/users_router.py +++ b/routers/users_router.py @@ -297,8 +297,6 @@ async def update_user( pasts = [] - if user_info["name"] != user_struct.name: - pasts.append(user_info["name"]) if user_info["id"] != user_struct.id: pasts.append(user_info["id"])