feat: add exam score management
This commit is contained in:
@@ -412,11 +412,13 @@ ${this.buildLearningAndResult(learnings, result, now)}
|
||||
const highestName = highestExam?.examName ?? '-';
|
||||
|
||||
// Improvement: last exam score minus first exam score
|
||||
const sortedExams = [...cultureExams].filter((e) => e.score != null);
|
||||
const sortedScores = cultureExams
|
||||
.map((exam) => exam.score)
|
||||
.filter((score): score is number => score !== null && score !== undefined);
|
||||
let improvement = '—';
|
||||
if (sortedExams.length >= 2) {
|
||||
const first = sortedExams[0].score;
|
||||
const last = sortedExams[sortedExams.length - 1].score;
|
||||
if (sortedScores.length >= 2) {
|
||||
const first = sortedScores[0];
|
||||
const last = sortedScores[sortedScores.length - 1];
|
||||
improvement = (last - first).toFixed(1);
|
||||
}
|
||||
|
||||
@@ -511,7 +513,7 @@ ${this.buildLearningAndResult(learnings, result, now)}
|
||||
const cultureExams = exams.filter((e) => e.score != null);
|
||||
if (cultureExams.length === 0) return '';
|
||||
|
||||
const scores = cultureExams.map((e) => e.score);
|
||||
const scores = cultureExams.map((e) => Number(e.score));
|
||||
const labels = cultureExams.map((e) => {
|
||||
const d = e.examDate || '-';
|
||||
return d.length > 7 ? d.slice(5) : d;
|
||||
|
||||
Reference in New Issue
Block a user