import fs from "node:fs";
const f = "src/shared/i18n/messages/zh-CN/attendance.json";
let c = fs.readFileSync(f, "utf8");
const oldStr = `"noDataDescription": "当前班级在所选时间范围内暂无考勤记录。"
  },
  "errors": {`;
const newStr = `"noDataDescription": "当前班级在所选时间范围内暂无考勤记录。"
  },
  "correlation": {
    "title": "考勤与成绩关联分析",
    "description": "{className} · {start} 至 {end} · 出勤率与平均成绩的相关性",
    "noData": "暂无关联分析数据",
    "noDataDescription": "所选班级在时间范围内无考勤或成绩记录，无法进行关联分析。",
    "noStudents": "暂无学生数据",
    "noStudentsDescription": "该班级在时间范围内无考勤与成绩匹配的学生。",
    "correlationCoefficient": "相关系数 r",
    "notAvailable": "数据不足",
    "scatterTitle": "出勤率-成绩散点图",
    "scatterSeries": "学生",
    "studentDetails": "学生明细",
    "riskLevelLabel": "风险等级",
    "attendanceRate": "出勤率",
    "averageScore": "平均成绩",
    "absentCount": "缺勤次数",
    "gradeRecordCount": "成绩记录数",
    "riskCounts": {
      "high": "高风险学生数",
      "medium": "中风险学生数",
      "low": "低风险学生数"
    },
    "riskLevel": {
      "high": "高风险",
      "medium": "中风险",
      "low": "低风险"
    },
    "interpretation": {
      "strong_negative": "强负相关：出勤率越低，成绩越低",
      "weak_negative": "弱负相关：出勤率与成绩有一定负相关",
      "negligible": "无明显线性相关",
      "weak_positive": "弱正相关：出勤率与成绩有一定正相关",
      "strong_positive": "强正相关：出勤率越高，成绩越高",
      "insufficient_data": "数据不足，无法计算相关性"
    }
  },
  "errors": {`;
if (!c.includes(oldStr)) {
  console.log("OLD NOT FOUND");
  process.exit(1);
}
c = c.replace(oldStr, newStr);
fs.writeFileSync(f, c);
console.log("Done");
