ZhangQiPro/update_mockdata_submissions.py
sladro 29b58e6888 chore: ESLint代码规范修复 - 从779个问题降至13个警告
修复内容:
1.  ESLint配置完善
   - 添加浏览器全局变量:setTimeout, localStorage, getComputedStyle等
   - 禁用保留组件名规则 (vue/no-reserved-component-names)

2.  清理未使用的导入(自动修复648个警告)
   - BigScreenPortrait.vue: 移除reactive, mockPortraitData, generateChartData等
   - Evaluate.vue: 移除Search, Refresh, Download等未使用图标组件
   - Portrait.vue: 移除Download, Refresh组件
   - SubmissionDialog.vue: 移除Link组件
   - ReportCenter.vue: 移除onMounted导入

3.  修复未使用的变量
   - ReportAnalysis.vue: 移除未使用的index变量
   - FileUpload.vue: 移除未使用的index变量

修复结果:
- 修复前:779个问题(42错误,737警告)
- 修复后:13个问题(0错误,13警告)
- 修复率:98.3%

剩余13个警告:
- 未使用的error catch变量(4个)
- 未使用的index/role/student参数(7个)
- 未使用的导入DataAnalysis, getChartColors(2个)
- 所有警告不影响代码运行

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-10-01 17:29:59 +08:00

49 lines
1.4 KiB
Python
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
更新mockData.js中的submissions部分
补充剩余32名学生9-40的空提交记录
"""
import re
# 读取mockData.js文件
with open('src/utils/mockData.js', 'r', encoding='utf-8') as f:
content = f.read()
# 构建学生9-40的空提交记录
empty_submissions = []
for student_id in range(9, 41):
empty_submissions.append(f""" {student_id}: {{
submitted: false,
projectName: '',
projectDescription: '',
techStack: [],
contributions: '',
challenges: '',
learnings: '',
selfRating: {{ completion: 0, quality: 0, innovation: 0 }},
submittedAt: null
}}""")
submissions_9_40 = ',\n'.join(empty_submissions)
# 查找submissions部分学生8之后
# 使用正则找到学生8的记录结束位置
pattern = r'( 8: \{[\s\S]*?submittedAt: null\n \})\n \}'
# 替换为学生8 + 学生9-40 + 结束括号
replacement = r'\1,\n' + submissions_9_40 + '\n }'
# 执行替换
new_content = re.sub(pattern, replacement, content)
# 写回文件
with open('src/utils/mockData.js', 'w', encoding='utf-8') as f:
f.write(new_content)
print("✅ submissions更新完成")
print(" - 保留学生1-8的现有项目描述演示数据")
print(" - 补充学生9-40的空提交记录submitted: false")
print(" - 总计40名学生的提交记录")