feat: implement modern Sınav Rapor dashboard with dual-metric delta tracking and inline mistake review
This commit is contained in:
parent
455baa6aa4
commit
f138403918
10 changed files with 2838 additions and 3 deletions
|
|
@ -1,6 +1,16 @@
|
|||
import fs from 'fs';
|
||||
import path from 'path';
|
||||
import { DatabaseSchema, StudentStore, Assignment, PrivateLesson, PrivateLessonFormMeta, PrivateLessonsStore } from '../types';
|
||||
import {
|
||||
DatabaseSchema,
|
||||
StudentStore,
|
||||
Assignment,
|
||||
PrivateLesson,
|
||||
PrivateLessonFormMeta,
|
||||
PrivateLessonsStore,
|
||||
ExamReportDetail,
|
||||
ExamStore,
|
||||
ExamTopicWeakness
|
||||
} from '../types';
|
||||
|
||||
const DB_FILE = path.resolve(process.cwd(), 'data', 'db.json');
|
||||
|
||||
|
|
@ -227,4 +237,52 @@ export class LocalDatabase {
|
|||
const student = this.cache.students[studentId];
|
||||
return student?.advisoryTeacher || student?.privateLessons?.detectedAdvisor || null;
|
||||
}
|
||||
|
||||
// ----------------------------------------------------
|
||||
// Exam Reports (Sınav Rapor) Store
|
||||
// ----------------------------------------------------
|
||||
|
||||
public saveExamReports(studentId: string, reports: ExamReportDetail[]): void {
|
||||
const student = this.getStudentStore(studentId);
|
||||
const existing = student.exams;
|
||||
const reportsMap: Record<string, ExamReportDetail> = existing?.reports ? { ...existing.reports } : {};
|
||||
|
||||
reports.forEach(r => {
|
||||
reportsMap[r.summary.id] = r;
|
||||
});
|
||||
|
||||
student.exams = {
|
||||
lastSynced: new Date().toISOString(),
|
||||
reports: reportsMap,
|
||||
topicWeaknesses: existing?.topicWeaknesses || {}
|
||||
};
|
||||
|
||||
this.save();
|
||||
}
|
||||
|
||||
public getExamReports(studentId: string): ExamStore | null {
|
||||
const student = this.cache.students[studentId];
|
||||
return student?.exams || null;
|
||||
}
|
||||
|
||||
public saveTopicWeaknesses(studentId: string, examId: string, weaknesses: ExamTopicWeakness[]): void {
|
||||
const student = this.getStudentStore(studentId);
|
||||
if (!student.exams) {
|
||||
student.exams = {
|
||||
lastSynced: new Date().toISOString(),
|
||||
reports: {},
|
||||
topicWeaknesses: {}
|
||||
};
|
||||
}
|
||||
if (!student.exams.topicWeaknesses) {
|
||||
student.exams.topicWeaknesses = {};
|
||||
}
|
||||
student.exams.topicWeaknesses[examId] = weaknesses;
|
||||
this.save();
|
||||
}
|
||||
|
||||
public getTopicWeaknesses(studentId: string, examId: string): ExamTopicWeakness[] | null {
|
||||
const student = this.cache.students[studentId];
|
||||
return student?.exams?.topicWeaknesses?.[examId] || null;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue