Files
online_sys/frontend_智能制造/verify_all_questions.py
KQL a7242f0c69 Initial commit: 教务系统在线平台
- 包含4个产业方向的前端项目:智能开发、智能制造、大健康、财经商贸
- 已清理node_modules、.yoyo等大文件,项目大小从2.6GB优化至631MB
- 配置完善的.gitignore文件

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

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2025-12-12 18:16:55 +08:00

106 lines
3.3 KiB
Python

#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
验证所有岗位群的面试题更新情况
"""
import json
import re
print("=== 验证所有岗位群面试题更新情况 ===\n")
# 1. 读取源数据获取预期题目数
print("1. 读取智能制造岗位简历.json获取预期数据...")
with open('网页未导入数据/智能制造产业/智能制造岗位简历.json', 'r', encoding='utf-8') as f:
source_data = json.load(f)
# 统计每个岗位群应有的题目数
expected_counts = {}
for item in source_data:
job_group = item.get('简历岗位群', '')
interview_content = item.get('面试题内容', '')
if job_group and interview_content and job_group not in expected_counts:
# 统计题目数量
question_count = len(re.findall(r'^\d+[\.、]\s+', interview_content, re.MULTILINE))
expected_counts[job_group] = question_count
print(f"预期的岗位群数量: {len(expected_counts)}")
# 2. 读取mock文件
print("\n2. 读取当前mock文件...")
with open('src/mocks/resumeInterviewMock.js', 'r', encoding='utf-8') as f:
mock_content = f.read()
# 3. 统计实际题目数
print("\n3. 统计各岗位群实际题目数...")
print("-" * 60)
print(f"{'岗位群':<20} {'预期':<10} {'实际':<10} {'状态':<10}")
print("-" * 60)
all_correct = True
total_expected = 0
total_actual = 0
# 按照在文件中出现的顺序检查
job_groups_order = [
"3D打印工艺", "CNC加工工艺", "PLC", "钣金工程", "产品测试",
"产品设计", "电气设计", "非标自动化设计", "工业机器人", "焊接工艺",
"机加工工艺", "机器视觉", "模具工程", "塑性成形工艺", "特种加工工艺", "自动化控制"
]
for job_group in job_groups_order:
expected = expected_counts.get(job_group, 0)
total_expected += expected
# 查找该岗位群在mock文件中的位置
pattern = f'"name": "{job_group}"'
group_pos = mock_content.find(pattern)
if group_pos == -1:
print(f"{job_group:<20} {expected:<10} {'未找到':<10}")
all_correct = False
continue
# 找到questions字段
questions_pos = mock_content.find('"questions":', group_pos)
if questions_pos == -1 or questions_pos - group_pos > 10000:
print(f"{job_group:<20} {expected:<10} {'无questions':<10}")
all_correct = False
continue
# 统计题目数量
# 找到下一个岗位群或文件结束
next_name_pos = mock_content.find('"name":', group_pos + len(pattern))
if next_name_pos == -1:
search_area = mock_content[questions_pos:]
else:
search_area = mock_content[questions_pos:next_name_pos]
actual = len(re.findall(r'"id": "q1_\d+"', search_area))
total_actual += actual
if actual == expected:
status = ""
else:
status = "⚠️"
all_correct = False
print(f"{job_group:<20} {expected:<10} {actual:<10} {status}")
print("-" * 60)
print(f"{'总计':<20} {total_expected:<10} {total_actual:<10}")
print("-" * 60)
# 4. 总结
print("\n4. 更新总结")
print("=" * 60)
if all_correct:
print("🎉 所有岗位群的面试题已完整更新!")
print(f"✅ 16个岗位群")
print(f"✅ 共{total_actual}道面试题")
else:
print("⚠️ 部分岗位群的面试题数量不匹配,请检查")
print("\n验证完成!")