소스 검색

bugfix: unfied data

Insouciant21 6 달 전
부모
커밋
65195f4da9
7개의 변경된 파일과 594개의 추가작업 그리고 591개의 파일을 삭제
  1. 11 21
      app/(dashboard)/analysis/AnalysisDashboard.tsx
  2. 22 3
      components/DashboardContent.tsx
  3. 8 4
      components/MetricsContent.tsx
  4. 518 562
      components/metricsData.ts
  5. 34 0
      lib/mockApi.ts
  6. 1 1
      next-env.d.ts
  7. 0 0
      tsconfig.tsbuildinfo

+ 11 - 21
app/(dashboard)/analysis/AnalysisDashboard.tsx

@@ -5,7 +5,7 @@ import Link from "next/link";
 import { useSearchParams } from "next/navigation";
 import { Target, ShieldCheck, Cpu, Code2, User } from "lucide-react";
 import { metricsData } from "@/components/metricsData";
-import { getMockStudentById } from "@/lib/mockApi";
+import { getMockStudentById, getMockClassAverageMetrics, getMockClassMacroAverages } from "@/lib/mockApi";
 import { useAuth } from "@/components/AuthProvider";
 
 function AnalysisDashboardContent() {
@@ -16,6 +16,8 @@ function AnalysisDashboardContent() {
   // Otherwise, if we are logged in as a student, use our own ID.
   const studentId = searchParams.get("student") || (user?.role === 'stu' ? user.id : null);
   const student = studentId ? getMockStudentById(studentId) : null;
+  const classAverages = useMemo(() => getMockClassAverageMetrics(), []);
+  const classMacros = useMemo(() => getMockClassMacroAverages(), []);
 
   // Helper function to colorize cells like a thermal heatmap based on parsed average score
   const getHeatmapClass = (scoreStr: string | number) => {
@@ -30,22 +32,17 @@ function AnalysisDashboardContent() {
   // When viewing a specific student, override each metric's avgScore
   // with the pre-generated score from the database. No random jitter.
   const displayData = useMemo(() => {
-    if (!student) return metricsData; // Default class average view
-
-    const personalizedData = JSON.parse(JSON.stringify(metricsData)) as typeof metricsData;
+    const personalizedData = JSON.parse(JSON.stringify(metricsData)) as Record<string, any[]>;
     
     Object.keys(personalizedData).forEach((catKey) => {
        personalizedData[catKey].forEach(item => {
-          // Read the pre-generated score from the student's metricScores
-          const storedScore = student.metricScores?.[item.id];
-          if (storedScore !== undefined) {
-            item.avgScore = storedScore.toString();
-          }
+          const score = student ? student.metricScores?.[item.id] : classAverages[item.id];
+          item.avgScore = score !== undefined ? score.toString() : "0";
        });
     });
 
     return personalizedData;
-  }, [student]);
+  }, [student, classAverages]);
 
   // Pre-calculate dimensional averages for the top macro view
   // When viewing a specific student, use their EXACT scores from the database
@@ -61,22 +58,15 @@ function AnalysisDashboardContent() {
            total: items.length
         };
       } else {
-        // Class average view: compute from metricsData sub-items
-        let sum = 0;
-        let count = 0;
-        items.forEach((item) => {
-          const itemScore = parseInt(item.avgScore) || 0;
-          sum += itemScore;
-          count++;
-        });
+        // Class average view: use macro averages
         stats[cat] = {
-           avg: count > 0 ? Math.round(sum / count) : 0,
-           total: count
+           avg: classMacros[cat] || 0,
+           total: items.length
         };
       }
     });
     return stats;
-  }, [displayData, student]);
+  }, [displayData, student, classMacros]);
 
   const icons = {
     K: <Target className="w-10 h-10 mb-3 opacity-80" />,

+ 22 - 3
components/DashboardContent.tsx

@@ -1,14 +1,33 @@
 "use client";
 
-import { useState } from "react";
+import { useState, useMemo } from "react";
 import { Download, ChevronDown, CheckCircle2 } from "lucide-react";
 import Link from "next/link";
 import { metricsData, MetricCategoryData } from "./metricsData";
+import { useAuth } from "@/components/AuthProvider";
+import { getMockStudentById, getMockClassAverageMetrics } from "@/lib/mockApi";
 
 export default function DashboardContent() {
+  const { user } = useAuth();
   const [expandedCard, setExpandedCard] = useState<string | null>(null);
   const [activeTab, setActiveTab] = useState<"K" | "A" | "S" | "D">("K");
 
+  const student = user?.role === 'stu' ? getMockStudentById(user.id) : null;
+  const classAverages = useMemo(() => getMockClassAverageMetrics(), []);
+
+  const displayData = useMemo(() => {
+    const personalizedData = JSON.parse(JSON.stringify(metricsData)) as Record<string, any[]>;
+    
+    Object.keys(personalizedData).forEach((catKey) => {
+       personalizedData[catKey].forEach(item => {
+          const score = student ? student.metricScores?.[item.id] : classAverages[item.id];
+          item.avgScore = score !== undefined ? score.toString() : "0";
+       });
+    });
+
+    return personalizedData as Record<string, (MetricCategoryData & { avgScore: string })[]>;
+  }, [student, classAverages]);
+
   const toggleCard = (id: string) => {
     setExpandedCard(expandedCard === id ? null : id);
   };
@@ -74,7 +93,7 @@ export default function DashboardContent() {
       </div>
 
       <div className="grid grid-cols-1 xl:grid-cols-2 gap-6">
-        {metricsData[activeTab].map((metric) => (
+        {displayData[activeTab].map((metric) => (
           <div
             key={metric.id}
             className={`bg-surface-container rounded-3xl p-6 shadow-elevation-1 hover:shadow-elevation-2 transition-all border border-outline-variant/50 group cursor-pointer ${expandedCard === metric.id ? "expanded" : ""}`}
@@ -174,7 +193,7 @@ export default function DashboardContent() {
               </tr>
             </thead>
             <tbody className="divide-y divide-outline-variant/20">
-              {metricsData[activeTab].slice(0, 4).map((metric, i) => {
+              {displayData[activeTab].slice(0, 4).map((metric, i) => {
                  const status = getMetricStatus(metric.avgScore);
                  return (
                   <tr

+ 8 - 4
components/MetricsContent.tsx

@@ -10,7 +10,7 @@ import {
 } from "lucide-react";
 import { useSearchParams } from "next/navigation";
 import { metricsData } from "./metricsData";
-import { getMockStudentById } from "@/lib/mockApi";
+import { getMockStudentById, getMockClassAverageMetrics } from "@/lib/mockApi";
 import { useAuth } from "@/components/AuthProvider";
 
 export default function MetricsContent({ metricId }: { metricId: string }) {
@@ -32,14 +32,18 @@ export default function MetricsContent({ metricId }: { metricId: string }) {
     );
   }
 
-  // When viewing a specific student, use their pre-generated score for this metric.
-  // Otherwise use the static class average from metricsData.
-  let scoreNum = parseFloat(metricObj.avgScore) || 85.0;
+  let scoreNum = 85.0; // fallback
   if (student) {
     const storedScore = student.metricScores?.[metricId.toUpperCase()];
     if (storedScore !== undefined) {
       scoreNum = storedScore;
     }
+  } else {
+    const classAvgs = getMockClassAverageMetrics();
+    const storedScore = classAvgs[metricId.toUpperCase()];
+    if (storedScore !== undefined) {
+       scoreNum = storedScore;
+    }
   }
 
   return (

+ 518 - 562
components/metricsData.ts

@@ -1,562 +1,518 @@
-import { CheckCircle2 } from "lucide-react";
-
-// Tailwind Safelist for dynamically constructed classes:
-// bg-chart-1 bg-chart-2 bg-chart-3 bg-chart-4 bg-chart-5 bg-tertiary bg-primary
-// text-chart-1 text-chart-2 text-chart-3 text-chart-4 text-chart-5 text-tertiary text-primary
-
-export type MetricValue = {
-  name: string;
-  score?: string;
-  coverage?: string;
-  accuracy?: string;
-};
-
-export type SubMetric = {
-  id: string;
-  name: string;
-  values: MetricValue[];
-};
-
-export type MetricCategoryData = {
-  id: string;
-  name: string;
-  description: string;
-  colorClass: string;
-  bgClass: string;
-  textClass: string;
-  avgScore: string;
-  subMetrics: SubMetric[];
-};
-
-export const metricsData: Record<string, MetricCategoryData[]> = {
-  K: [
-    {
-      id: "K1",
-      name: "软件工程核心概念掌握能力",
-      description: "软件工程核心概念能力",
-      colorClass: "chart-3",
-      bgClass: "bg-primary-container text-on-primary-container",
-      textClass: "text-primary",
-      avgScore: "85%",
-      subMetrics: [
-        {
-          id: "K1-1",
-          name: "软件工程概念理解能力",
-          values: [
-            { name: "概念答题正确率" },
-            { name: "核心知识点覆盖率" },
-          ],
-        },
-        {
-          id: "K1-2",
-          name: "核心概念考试得分能力",
-          values: [{ name: "核心知识点测验得分" }],
-        },
-      ],
-    },
-    {
-      id: "K2",
-      name: "软件工程规范与原理的掌握能力",
-      description: "软件工程系统规范与原理的掌握能力",
-      colorClass: "tertiary",
-      bgClass: "bg-tertiary-container text-on-tertiary-container",
-      textClass: "text-tertiary",
-      avgScore: "78%",
-      subMetrics: [
-        {
-          id: "K2-1",
-          name: "软件工程原理理解题能力",
-          values: [
-            { name: "原理类题目答题正确率" },
-            { name: "原理知识点测验得分" },
-            { name: "原理知识点覆盖率" },
-          ],
-        },
-        {
-          id: "K2-2",
-          name: "软件工程规范条款熟悉能力",
-          values: [
-            { name: "规范类题目答题正确率" },
-            { name: "规范条款测验得分" },
-            { name: "规范知识点覆盖率" },
-          ],
-        },
-      ],
-    },
-    {
-      id: "K3",
-      name: "前沿技术认知能力",
-      description: "前沿技术认知与掌握",
-      colorClass: "chart-1",
-      bgClass: "bg-secondary-container text-on-secondary-container",
-      textClass: "text-chart-1",
-      avgScore: "82%",
-      subMetrics: [
-        {
-          id: "K3-1",
-          name: "前沿技术解题能力",
-          values: [
-            { name: "前沿技术知识点测验得分" },
-            { name: "前沿技术答题认知正确率" },
-          ],
-        },
-        {
-          id: "K3-2",
-          name: "技术发展趋势认知能力",
-          values: [
-            { name: "前沿技术知识点覆盖数" },
-          ],
-        },
-      ],
-    },
-  ],
-  A: [
-    {
-      id: "A1",
-      name: "提示词写作能力",
-      description: "结构与细节控制能力",
-      colorClass: "chart-4",
-      bgClass: "bg-chart-5-container text-chart-5",
-      textClass: "text-chart-4",
-      avgScore: "89%",
-      subMetrics: [
-        {
-          id: "A1-1",
-          name: "提示词结构性写作能力",
-          values: [{ name: "有效提示词占比" }],
-        },
-        {
-          id: "A1-2",
-          name: "工程语义准确性表达 + B6",
-          values: [{ name: "单轮目标达成率" }],
-        },
-        {
-          id: "A1-3",
-          name: "迭代意识能力",
-          values: [{ name: "提示词优化迭代次数" }],
-        },
-        {
-          id: "A1-4",
-          name: "边界设定能力",
-          values: [{ name: "提示词边界约束符合率" }],
-        },
-      ],
-    },
-    {
-      id: "A2",
-      name: "AI 输出驾驭能力",
-      description: "结果召回能力",
-      colorClass: "chart-3",
-      bgClass: "bg-primary-container text-on-primary-container",
-      textClass: "text-primary",
-      avgScore: "84%",
-      subMetrics: [
-        {
-          id: "A2-1",
-          name: "缺陷识别能力",
-          values: [{ name: "AI 输出缺陷识别率" }],
-        },
-        {
-          id: "A2-2",
-          name: "误报精准能力",
-          values: [{ name: "缺陷误报精准率" }],
-        },
-      ],
-    },
-    {
-      id: "A3",
-      name: "人机协同工作流规范能力",
-      description: "人机交互与编排能力",
-      colorClass: "tertiary",
-      bgClass: "bg-tertiary-container text-on-tertiary-container",
-      textClass: "text-tertiary",
-      avgScore: "92%",
-      subMetrics: [
-        {
-          id: "A3-1",
-          name: "人机协同流程安排能力",
-          values: [{ name: "流程节点合规率" }],
-        },
-        {
-          id: "A3-2",
-          name: "人机任务分工能力",
-          values: [{ name: "人机协同提升的工作效率" }],
-        },
-        {
-          id: "A3-3",
-          name: "协同过程留痕能力",
-          values: [{ name: "规范流程执行次数" }],
-        },
-      ],
-    },
-    {
-      id: "A4",
-      name: "批判审查 AI 输出能力",
-      description: "验证及纠错分析能力",
-      colorClass: "chart-1",
-      bgClass: "bg-secondary-container text-on-secondary-container",
-      textClass: "text-chart-1",
-      avgScore: "76%",
-      subMetrics: [
-        {
-          id: "A4-1",
-          name: "AI 输出逻辑漏洞检出能力",
-          values: [{ name: "AI 输出问题识别率" }],
-        },
-        {
-          id: "A4-2",
-          name: "AI 生成代码漏洞排查能力",
-          values: [{ name: "AI 生成代码审查命中率" }],
-        },
-        {
-          id: "A4-3",
-          name: "输出内容合规性检查能力",
-          values: [{ name: "AI 输出风险点排查数量" }],
-        },
-      ],
-    },
-    {
-      id: "A5",
-      name: "冲突识别能力",
-      description: "解决 AI 回复冲突的能力",
-      colorClass: "chart-5",
-      bgClass: "bg-chart-5-container text-chart-5",
-      textClass: "text-chart-5",
-      avgScore: "81%",
-      subMetrics: [
-        {
-          id: "A5-1",
-          name: "AI 输出与需求目标冲突识别能力",
-          values: [{ name: "需求与实现冲突识别率" }],
-        },
-        {
-          id: "A5-2",
-          name: "多轮 AI 输出内容矛盾冲突识别能力",
-          values: [{ name: "多源 / 多轮输出冲突识别数" }],
-        },
-        {
-          id: "A5-3",
-          name: "AI 输出与行业规范冲突识别能力",
-          values: [{ name: "规范冲突点识别率" }],
-        },
-      ],
-    },
-    {
-      id: "A6",
-      name: "权衡决策能力",
-      description: "多方面决策及评估",
-      colorClass: "chart-4",
-      bgClass: "bg-primary-container text-on-primary-container",
-      textClass: "text-primary",
-      avgScore: "95%",
-      subMetrics: [
-        {
-          id: "A6-1",
-          name: "AI 多方案选优能力",
-          values: [{ name: "多方案决策次数" }],
-        },
-        {
-          id: "A6-2",
-          name: "人机分工权衡能力",
-          values: [{ name: "决策次数占总生成次数的比例" }],
-        },
-      ],
-    },
-    {
-      id: "A7",
-      name: "伦理把关能力",
-      description: "数据安全与隐私控制",
-      colorClass: "tertiary",
-      bgClass: "bg-tertiary-container text-on-tertiary-container",
-      textClass: "text-tertiary",
-      avgScore: "88%",
-      subMetrics: [
-        {
-          id: "A7-1",
-          name: "知识产权合规风险把关能力",
-          values: [{ name: "知识产权合规风险识别率" }, { name: "知识产权风险规避处理次数" }],
-        },
-        {
-          id: "A7-2",
-          name: "数据安全风险把关能力",
-          values: [{ name: "数据安全合规风险识别率" }, { name: "数据安全风险规避处理次数" }],
-        },
-        {
-          id: "A7-3",
-          name: "行业伦理规范契合度把关能力",
-          values: [{ name: "行业伦理规范遵循率" }],
-        },
-      ],
-    },
-  ],
-  S: [
-    {
-      id: "S1",
-      name: "软件工程文档编写能力",
-      description: "软件工程文档编写能力",
-      colorClass: "chart-3",
-      bgClass: "bg-primary-container text-on-primary-container",
-      textClass: "text-primary",
-      avgScore: "86%",
-      subMetrics: [
-        {
-          id: "S1-1",
-          name: "文档核心模块写作能力",
-          values: [{ name: "文档完整度评分" }],
-        },
-        {
-          id: "S1-2",
-          name: "文档与项目需求匹配能力",
-          values: [{ name: "文档需求匹配符合率" }],
-        },
-        {
-          id: "S1-3",
-          name: "文档可读性能力",
-          values: [{ name: "文档可读性标准化评分" }, { name: "文档规范符合率" }],
-        },
-      ],
-    },
-    {
-      id: "S2",
-      name: "项目需求分析能力",
-      description: "业务需求抽取与分析",
-      colorClass: "tertiary",
-      bgClass: "bg-tertiary-container text-on-tertiary-container",
-      textClass: "text-tertiary",
-      avgScore: "82%",
-      subMetrics: [
-        {
-          id: "S2-1",
-          name: "需求调研能力",
-          values: [{ name: "需求调研次数" }],
-        },
-        {
-          id: "S2-2",
-          name: "需求分层拆解能力",
-          values: [{ name: "需求拆解完整评分" }],
-        },
-        {
-          id: "S2-3",
-          name: "需求可行性分析能力",
-          values: [{ name: "需求可行性评分" }],
-        },
-        {
-          id: "S2-4",
-          name: "需求变更管控能力",
-          values: [{ name: "需求变更处理次数" }],
-        },
-      ],
-    },
-    {
-      id: "S3",
-      name: "代码产出能力",
-      description: "代码输出及功能实现",
-      colorClass: "chart-1",
-      bgClass: "bg-secondary-container text-on-secondary-container",
-      textClass: "text-chart-1",
-      avgScore: "85%",
-      subMetrics: [
-        {
-          id: "S3-1",
-          name: "单位时间有效代码产出能力",
-          values: [{ name: "有效代码行数" }, { name: "代码每日产出效率" }],
-        },
-        {
-          id: "S3-2",
-          name: "业务逻辑实现匹配能力",
-          values: [{ name: "业务逻辑实现匹配率" }],
-        },
-      ],
-    },
-    {
-      id: "S4",
-      name: "工具使用能力",
-      description: "开发工具熟练度",
-      colorClass: "chart-4",
-      bgClass: "bg-chart-5-container text-chart-5",
-      textClass: "text-chart-4",
-      avgScore: "91%",
-      subMetrics: [
-        {
-          id: "S4-1",
-          name: "开发核心工具操作能力",
-          values: [{ name: "核心工具有效使用次数" }],
-        },
-        {
-          id: "S4-2",
-          name: "工具使用种类与广度能力",
-          values: [{ name: "工具使用种类数" }],
-        },
-      ],
-    },
-    {
-      id: "S5",
-      name: "代码质量产出能力",
-      description: "代码规范与维护性",
-      colorClass: "chart-5",
-      bgClass: "bg-primary-container text-on-primary-container",
-      textClass: "text-primary",
-      avgScore: "88%",
-      subMetrics: [
-        {
-          id: "S5-1",
-          name: "编码规范符合能力",
-          values: [{ name: "代码规范符合率" }],
-        },
-        {
-          id: "S5-2",
-          name: "代码复杂度达标能力",
-          values: [{ name: "代码圈复杂度达标率" }, { name: "代码缺陷占比" }],
-        },
-        {
-          id: "S5-3",
-          name: "代码可维护性能力",
-          values: [{ name: "代码可维护性评分" }],
-        },
-        {
-          id: "S5-4",
-          name: "核心注释覆盖能力",
-          values: [{ name: "核心代码注释覆盖率" }],
-        },
-      ],
-    },
-    {
-      id: "S6",
-      name: "项目调试能力",
-      description: "架构设计与拓展性",
-      colorClass: "tertiary",
-      bgClass: "bg-tertiary-container text-on-tertiary-container",
-      textClass: "text-tertiary",
-      avgScore: "79%",
-      subMetrics: [
-        {
-          id: "S6-1",
-          name: "Bug 定位能力",
-          values: [{ name: "问题定位准确率" }],
-        },
-        {
-          id: "S6-2",
-          name: "Bug 修复能力",
-          values: [{ name: "缺陷成功修复率" }, { name: "问题解决总数" }],
-        },
-        {
-          id: "S6-3",
-          name: "单问题平均调试耗时",
-          values: [{ name: "平均缺陷修复时长" }],
-        },
-      ],
-    },
-    {
-      id: "S7",
-      name: "版本管理能力",
-      description: "代码版本及配置分支控制",
-      colorClass: "chart-1",
-      bgClass: "bg-secondary-container text-on-secondary-container",
-      textClass: "text-chart-1",
-      avgScore: "87%",
-      subMetrics: [
-        {
-          id: "S7-1",
-          name: "分支管理规范能力",
-          values: [{ name: "分支管理合规次数" }],
-        },
-        {
-          id: "S7-2",
-          name: "提交记录规范度能力",
-          values: [{ name: "版本规范遵循率" }],
-        },
-        {
-          id: "S7-3",
-          name: "协作版本冲突解决能力",
-          values: [{ name: "版本冲突解决成功率" }],
-        },
-      ],
-    },
-  ],
-  D: [
-    {
-      id: "D1",
-      name: "作业答题态度能力",
-      description: "提交规范与通过率",
-      colorClass: "chart-3",
-      bgClass: "bg-primary-container text-on-primary-container",
-      textClass: "text-primary",
-      avgScore: "94%",
-      subMetrics: [
-        {
-          id: "D1-1",
-          name: "作业按时提交率",
-          values: [{ name: "作业按时提交率" }, { name: "作业完成率" }],
-        },
-        {
-          id: "D1-2",
-          name: "作业得分能力",
-          values: [{ name: "答题平均得分" }, { name: "作业修改次数" }],
-        },
-      ],
-    },
-    {
-      id: "D2",
-      name: "时间管理能力",
-      description: "任务时间节点把控",
-      colorClass: "chart-4",
-      bgClass: "bg-chart-5-container text-chart-5",
-      textClass: "text-chart-4",
-      avgScore: "88%",
-      subMetrics: [
-        {
-          id: "D2-1",
-          name: "作业准时提交时间管理能力",
-          values: [{ name: "作业准时提交率" }],
-        },
-        {
-          id: "D2-2",
-          name: "多任务并行时间管理能力",
-          values: [{ name: "任务按时完成率" }, { name: "里程碑达成率" }],
-        },
-      ],
-    },
-    {
-      id: "D3",
-      name: "自主学习能力",
-      description: "自我驱动及学习研究",
-      colorClass: "tertiary",
-      bgClass: "bg-tertiary-container text-on-tertiary-container",
-      textClass: "text-tertiary",
-      avgScore: "85%",
-      subMetrics: [
-        {
-          id: "D3-1",
-          name: "自主练习时长",
-          values: [{ name: "自主学习 / 练习时长" }],
-        },
-        {
-          id: "D3-2",
-          name: "自主练习情况",
-          values: [{ name: "自主练习完成率" }, { name: "学习资料查阅数量" }],
-        },
-      ],
-    },
-    {
-      id: "D4",
-      name: "团队协作能力",
-      description: "个人与团队协作关系",
-      colorClass: "chart-1",
-      bgClass: "bg-secondary-container text-on-secondary-container",
-      textClass: "text-chart-1",
-      avgScore: "90%",
-      subMetrics: [
-        {
-          id: "D4-1",
-          name: "个人分工任务按时完成能力",
-          values: [{ name: "协作任务完成率" }],
-        },
-        {
-          id: "D4-2",
-          name: "团队内部沟通能力",
-          values: [{ name: "团队沟通平均响应耗时" }, { name: "有效协作次数" }, { name: "协作冲突解决次数" }],
-        },
-      ],
-    },
-  ],
-};
+import { CheckCircle2 } from "lucide-react";
+
+// Tailwind Safelist for dynamically constructed classes:
+// bg-chart-1 bg-chart-2 bg-chart-3 bg-chart-4 bg-chart-5 bg-tertiary bg-primary
+// text-chart-1 text-chart-2 text-chart-3 text-chart-4 text-chart-5 text-tertiary text-primary
+
+export type MetricValue = {
+  name: string;
+  score?: string;
+  coverage?: string;
+  accuracy?: string;
+};
+
+export type SubMetric = {
+  id: string;
+  name: string;
+  values: MetricValue[];
+};
+
+export type MetricCategoryData = {
+  id: string;
+  name: string;
+  description: string;
+  colorClass: string;
+  bgClass: string;
+  textClass: string;
  subMetrics: SubMetric[];
+};
+
+export const metricsData: Record<string, MetricCategoryData[]> = {
+  K: [
+    {
+      id: "K1",
+      name: "软件工程核心概念掌握能力",
+      description: "软件工程核心概念能力",
+      colorClass: "chart-3",
+      bgClass: "bg-primary-container text-on-primary-container",
+      textClass: "text-primary",
      subMetrics: [
+        {
+          id: "K1-1",
+          name: "软件工程概念理解能力",
+          values: [
+            { name: "概念答题正确率" },
+            { name: "核心知识点覆盖率" },
+          ],
+        },
+        {
+          id: "K1-2",
+          name: "核心概念考试得分能力",
+          values: [{ name: "核心知识点测验得分" }],
+        },
+      ],
+    },
+    {
+      id: "K2",
+      name: "软件工程规范与原理的掌握能力",
+      description: "软件工程系统规范与原理的掌握能力",
+      colorClass: "tertiary",
+      bgClass: "bg-tertiary-container text-on-tertiary-container",
+      textClass: "text-tertiary",
      subMetrics: [
+        {
+          id: "K2-1",
+          name: "软件工程原理理解题能力",
+          values: [
+            { name: "原理类题目答题正确率" },
+            { name: "原理知识点测验得分" },
+            { name: "原理知识点覆盖率" },
+          ],
+        },
+        {
+          id: "K2-2",
+          name: "软件工程规范条款熟悉能力",
+          values: [
+            { name: "规范类题目答题正确率" },
+            { name: "规范条款测验得分" },
+            { name: "规范知识点覆盖率" },
+          ],
+        },
+      ],
+    },
+    {
+      id: "K3",
+      name: "前沿技术认知能力",
+      description: "前沿技术认知与掌握",
+      colorClass: "chart-1",
+      bgClass: "bg-secondary-container text-on-secondary-container",
+      textClass: "text-chart-1",
      subMetrics: [
+        {
+          id: "K3-1",
+          name: "前沿技术解题能力",
+          values: [
+            { name: "前沿技术知识点测验得分" },
+            { name: "前沿技术答题认知正确率" },
+          ],
+        },
+        {
+          id: "K3-2",
+          name: "技术发展趋势认知能力",
+          values: [
+            { name: "前沿技术知识点覆盖数" },
+          ],
+        },
+      ],
+    },
+  ],
+  A: [
+    {
+      id: "A1",
+      name: "提示词写作能力",
+      description: "结构与细节控制能力",
+      colorClass: "chart-4",
+      bgClass: "bg-chart-5-container text-chart-5",
+      textClass: "text-chart-4",
      subMetrics: [
+        {
+          id: "A1-1",
+          name: "提示词结构性写作能力",
+          values: [{ name: "有效提示词占比" }],
+        },
+        {
+          id: "A1-2",
+          name: "工程语义准确性表达 + B6",
+          values: [{ name: "单轮目标达成率" }],
+        },
+        {
+          id: "A1-3",
+          name: "迭代意识能力",
+          values: [{ name: "提示词优化迭代次数" }],
+        },
+        {
+          id: "A1-4",
+          name: "边界设定能力",
+          values: [{ name: "提示词边界约束符合率" }],
+        },
+      ],
+    },
+    {
+      id: "A2",
+      name: "AI 输出驾驭能力",
+      description: "结果召回能力",
+      colorClass: "chart-3",
+      bgClass: "bg-primary-container text-on-primary-container",
+      textClass: "text-primary",
      subMetrics: [
+        {
+          id: "A2-1",
+          name: "缺陷识别能力",
+          values: [{ name: "AI 输出缺陷识别率" }],
+        },
+        {
+          id: "A2-2",
+          name: "误报精准能力",
+          values: [{ name: "缺陷误报精准率" }],
+        },
+      ],
+    },
+    {
+      id: "A3",
+      name: "人机协同工作流规范能力",
+      description: "人机交互与编排能力",
+      colorClass: "tertiary",
+      bgClass: "bg-tertiary-container text-on-tertiary-container",
+      textClass: "text-tertiary",
      subMetrics: [
+        {
+          id: "A3-1",
+          name: "人机协同流程安排能力",
+          values: [{ name: "流程节点合规率" }],
+        },
+        {
+          id: "A3-2",
+          name: "人机任务分工能力",
+          values: [{ name: "人机协同提升的工作效率" }],
+        },
+        {
+          id: "A3-3",
+          name: "协同过程留痕能力",
+          values: [{ name: "规范流程执行次数" }],
+        },
+      ],
+    },
+    {
+      id: "A4",
+      name: "批判审查 AI 输出能力",
+      description: "验证及纠错分析能力",
+      colorClass: "chart-1",
+      bgClass: "bg-secondary-container text-on-secondary-container",
+      textClass: "text-chart-1",
      subMetrics: [
+        {
+          id: "A4-1",
+          name: "AI 输出逻辑漏洞检出能力",
+          values: [{ name: "AI 输出问题识别率" }],
+        },
+        {
+          id: "A4-2",
+          name: "AI 生成代码漏洞排查能力",
+          values: [{ name: "AI 生成代码审查命中率" }],
+        },
+        {
+          id: "A4-3",
+          name: "输出内容合规性检查能力",
+          values: [{ name: "AI 输出风险点排查数量" }],
+        },
+      ],
+    },
+    {
+      id: "A5",
+      name: "冲突识别能力",
+      description: "解决 AI 回复冲突的能力",
+      colorClass: "chart-5",
+      bgClass: "bg-chart-5-container text-chart-5",
+      textClass: "text-chart-5",
      subMetrics: [
+        {
+          id: "A5-1",
+          name: "AI 输出与需求目标冲突识别能力",
+          values: [{ name: "需求与实现冲突识别率" }],
+        },
+        {
+          id: "A5-2",
+          name: "多轮 AI 输出内容矛盾冲突识别能力",
+          values: [{ name: "多源 / 多轮输出冲突识别数" }],
+        },
+        {
+          id: "A5-3",
+          name: "AI 输出与行业规范冲突识别能力",
+          values: [{ name: "规范冲突点识别率" }],
+        },
+      ],
+    },
+    {
+      id: "A6",
+      name: "权衡决策能力",
+      description: "多方面决策及评估",
+      colorClass: "chart-4",
+      bgClass: "bg-primary-container text-on-primary-container",
+      textClass: "text-primary",
      subMetrics: [
+        {
+          id: "A6-1",
+          name: "AI 多方案选优能力",
+          values: [{ name: "多方案决策次数" }],
+        },
+        {
+          id: "A6-2",
+          name: "人机分工权衡能力",
+          values: [{ name: "决策次数占总生成次数的比例" }],
+        },
+      ],
+    },
+    {
+      id: "A7",
+      name: "伦理把关能力",
+      description: "数据安全与隐私控制",
+      colorClass: "tertiary",
+      bgClass: "bg-tertiary-container text-on-tertiary-container",
+      textClass: "text-tertiary",
      subMetrics: [
+        {
+          id: "A7-1",
+          name: "知识产权合规风险把关能力",
+          values: [{ name: "知识产权合规风险识别率" }, { name: "知识产权风险规避处理次数" }],
+        },
+        {
+          id: "A7-2",
+          name: "数据安全风险把关能力",
+          values: [{ name: "数据安全合规风险识别率" }, { name: "数据安全风险规避处理次数" }],
+        },
+        {
+          id: "A7-3",
+          name: "行业伦理规范契合度把关能力",
+          values: [{ name: "行业伦理规范遵循率" }],
+        },
+      ],
+    },
+  ],
+  S: [
+    {
+      id: "S1",
+      name: "软件工程文档编写能力",
+      description: "软件工程文档编写能力",
+      colorClass: "chart-3",
+      bgClass: "bg-primary-container text-on-primary-container",
+      textClass: "text-primary",
      subMetrics: [
+        {
+          id: "S1-1",
+          name: "文档核心模块写作能力",
+          values: [{ name: "文档完整度评分" }],
+        },
+        {
+          id: "S1-2",
+          name: "文档与项目需求匹配能力",
+          values: [{ name: "文档需求匹配符合率" }],
+        },
+        {
+          id: "S1-3",
+          name: "文档可读性能力",
+          values: [{ name: "文档可读性标准化评分" }, { name: "文档规范符合率" }],
+        },
+      ],
+    },
+    {
+      id: "S2",
+      name: "项目需求分析能力",
+      description: "业务需求抽取与分析",
+      colorClass: "tertiary",
+      bgClass: "bg-tertiary-container text-on-tertiary-container",
+      textClass: "text-tertiary",
      subMetrics: [
+        {
+          id: "S2-1",
+          name: "需求调研能力",
+          values: [{ name: "需求调研次数" }],
+        },
+        {
+          id: "S2-2",
+          name: "需求分层拆解能力",
+          values: [{ name: "需求拆解完整评分" }],
+        },
+        {
+          id: "S2-3",
+          name: "需求可行性分析能力",
+          values: [{ name: "需求可行性评分" }],
+        },
+        {
+          id: "S2-4",
+          name: "需求变更管控能力",
+          values: [{ name: "需求变更处理次数" }],
+        },
+      ],
+    },
+    {
+      id: "S3",
+      name: "代码产出能力",
+      description: "代码输出及功能实现",
+      colorClass: "chart-1",
+      bgClass: "bg-secondary-container text-on-secondary-container",
+      textClass: "text-chart-1",
      subMetrics: [
+        {
+          id: "S3-1",
+          name: "单位时间有效代码产出能力",
+          values: [{ name: "有效代码行数" }, { name: "代码每日产出效率" }],
+        },
+        {
+          id: "S3-2",
+          name: "业务逻辑实现匹配能力",
+          values: [{ name: "业务逻辑实现匹配率" }],
+        },
+      ],
+    },
+    {
+      id: "S4",
+      name: "工具使用能力",
+      description: "开发工具熟练度",
+      colorClass: "chart-4",
+      bgClass: "bg-chart-5-container text-chart-5",
+      textClass: "text-chart-4",
      subMetrics: [
+        {
+          id: "S4-1",
+          name: "开发核心工具操作能力",
+          values: [{ name: "核心工具有效使用次数" }],
+        },
+        {
+          id: "S4-2",
+          name: "工具使用种类与广度能力",
+          values: [{ name: "工具使用种类数" }],
+        },
+      ],
+    },
+    {
+      id: "S5",
+      name: "代码质量产出能力",
+      description: "代码规范与维护性",
+      colorClass: "chart-5",
+      bgClass: "bg-primary-container text-on-primary-container",
+      textClass: "text-primary",
      subMetrics: [
+        {
+          id: "S5-1",
+          name: "编码规范符合能力",
+          values: [{ name: "代码规范符合率" }],
+        },
+        {
+          id: "S5-2",
+          name: "代码复杂度达标能力",
+          values: [{ name: "代码圈复杂度达标率" }, { name: "代码缺陷占比" }],
+        },
+        {
+          id: "S5-3",
+          name: "代码可维护性能力",
+          values: [{ name: "代码可维护性评分" }],
+        },
+        {
+          id: "S5-4",
+          name: "核心注释覆盖能力",
+          values: [{ name: "核心代码注释覆盖率" }],
+        },
+      ],
+    },
+    {
+      id: "S6",
+      name: "项目调试能力",
+      description: "架构设计与拓展性",
+      colorClass: "tertiary",
+      bgClass: "bg-tertiary-container text-on-tertiary-container",
+      textClass: "text-tertiary",
      subMetrics: [
+        {
+          id: "S6-1",
+          name: "Bug 定位能力",
+          values: [{ name: "问题定位准确率" }],
+        },
+        {
+          id: "S6-2",
+          name: "Bug 修复能力",
+          values: [{ name: "缺陷成功修复率" }, { name: "问题解决总数" }],
+        },
+        {
+          id: "S6-3",
+          name: "单问题平均调试耗时",
+          values: [{ name: "平均缺陷修复时长" }],
+        },
+      ],
+    },
+    {
+      id: "S7",
+      name: "版本管理能力",
+      description: "代码版本及配置分支控制",
+      colorClass: "chart-1",
+      bgClass: "bg-secondary-container text-on-secondary-container",
+      textClass: "text-chart-1",
      subMetrics: [
+        {
+          id: "S7-1",
+          name: "分支管理规范能力",
+          values: [{ name: "分支管理合规次数" }],
+        },
+        {
+          id: "S7-2",
+          name: "提交记录规范度能力",
+          values: [{ name: "版本规范遵循率" }],
+        },
+        {
+          id: "S7-3",
+          name: "协作版本冲突解决能力",
+          values: [{ name: "版本冲突解决成功率" }],
+        },
+      ],
+    },
+  ],
+  D: [
+    {
+      id: "D1",
+      name: "作业答题态度能力",
+      description: "提交规范与通过率",
+      colorClass: "chart-3",
+      bgClass: "bg-primary-container text-on-primary-container",
+      textClass: "text-primary",
      subMetrics: [
+        {
+          id: "D1-1",
+          name: "作业按时提交率",
+          values: [{ name: "作业按时提交率" }, { name: "作业完成率" }],
+        },
+        {
+          id: "D1-2",
+          name: "作业得分能力",
+          values: [{ name: "答题平均得分" }, { name: "作业修改次数" }],
+        },
+      ],
+    },
+    {
+      id: "D2",
+      name: "时间管理能力",
+      description: "任务时间节点把控",
+      colorClass: "chart-4",
+      bgClass: "bg-chart-5-container text-chart-5",
+      textClass: "text-chart-4",
      subMetrics: [
+        {
+          id: "D2-1",
+          name: "作业准时提交时间管理能力",
+          values: [{ name: "作业准时提交率" }],
+        },
+        {
+          id: "D2-2",
+          name: "多任务并行时间管理能力",
+          values: [{ name: "任务按时完成率" }, { name: "里程碑达成率" }],
+        },
+      ],
+    },
+    {
+      id: "D3",
+      name: "自主学习能力",
+      description: "自我驱动及学习研究",
+      colorClass: "tertiary",
+      bgClass: "bg-tertiary-container text-on-tertiary-container",
+      textClass: "text-tertiary",
      subMetrics: [
+        {
+          id: "D3-1",
+          name: "自主练习时长",
+          values: [{ name: "自主学习 / 练习时长" }],
+        },
+        {
+          id: "D3-2",
+          name: "自主练习情况",
+          values: [{ name: "自主练习完成率" }, { name: "学习资料查阅数量" }],
+        },
+      ],
+    },
+    {
+      id: "D4",
+      name: "团队协作能力",
+      description: "个人与团队协作关系",
+      colorClass: "chart-1",
+      bgClass: "bg-secondary-container text-on-secondary-container",
+      textClass: "text-chart-1",
      subMetrics: [
+        {
+          id: "D4-1",
+          name: "个人分工任务按时完成能力",
+          values: [{ name: "协作任务完成率" }],
+        },
+        {
+          id: "D4-2",
+          name: "团队内部沟通能力",
+          values: [{ name: "团队沟通平均响应耗时" }, { name: "有效协作次数" }, { name: "协作冲突解决次数" }],
+        },
+      ],
+    },
+  ],
+};

+ 34 - 0
lib/mockApi.ts

@@ -301,3 +301,37 @@ export const mockApi = {
 export const getMockStudentById = (id: string): MockStudent | undefined => {
   return initMockData().find(s => s.id === id);
 };
+
+export const getMockClassAverageMetrics = (): MetricScores => {
+  const students = initMockData();
+  if (students.length === 0) return {};
+  const totals: Record<string, number> = {};
+  students.forEach(s => {
+    Object.entries(s.metricScores).forEach(([k, v]) => {
+      totals[k] = (totals[k] || 0) + v;
+    });
+  });
+  const avgs: MetricScores = {};
+  Object.keys(totals).forEach(k => {
+    avgs[k] = Math.round(totals[k] / students.length);
+  });
+  return avgs;
+};
+
+export const getMockClassMacroAverages = (): Record<string, number> => {
+  const students = initMockData();
+  if (students.length === 0) return { K: 0, A: 0, S: 0, D: 0 };
+  const totals = { K: 0, A: 0, S: 0, D: 0 };
+  students.forEach(s => {
+    totals.K += s.K;
+    totals.A += s.A;
+    totals.S += s.S;
+    totals.D += s.D;
+  });
+  return {
+    K: Math.round(totals.K / students.length),
+    A: Math.round(totals.A / students.length),
+    S: Math.round(totals.S / students.length),
+    D: Math.round(totals.D / students.length),
+  };
+};

+ 1 - 1
next-env.d.ts

@@ -1,6 +1,6 @@
 /// <reference types="next" />
 /// <reference types="next/image-types/global" />
-import "./.next/types/routes.d.ts";
+import "./.next/dev/types/routes.d.ts";
 
 // NOTE: This file should not be edited
 // see https://nextjs.org/docs/app/api-reference/config/typescript for more information.

파일 크기가 너무 크기때문에 변경 상태를 표시하지 않습니다.
+ 0 - 0
tsconfig.tsbuildinfo


이 변경점에서 너무 많은 파일들이 변경되어 몇몇 파일들은 표시되지 않았습니다.