diff --git a/routers/activities_v2_router.py b/routers/activities_v2_router.py index d48fe0e..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()}. 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()} (ID: {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() 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"]) 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": "ボランティア明細表", - }, - }, } 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, ""