test : changed test format + added playwright support
Check Deno code / Check Deno code (pull_request) Has been cancelled
Tests / Unit tests (pull_request) Has been cancelled
Tests / Integration tests (pull_request) Has been cancelled
Check Deno code / Check Deno code (push) Has been cancelled
Tests / Unit tests (push) Has been cancelled
Tests / Integration tests (push) Has been cancelled

This commit was merged in pull request #153.
This commit is contained in:
2026-05-03 21:52:02 +02:00
parent ed2fe69f54
commit 951c9c1fea
52 changed files with 3576 additions and 5212 deletions
+27 -23
View File
@@ -2,6 +2,11 @@
import * as XLSX from "https://cdn.sheetjs.com/xlsx-0.20.3/package/xlsx.mjs";
import { useEffect, useRef } from "preact/hooks";
import { useSignal } from "@preact/signals";
import {
calculateWeightedAverage,
getEffectiveNote,
roundGrade,
} from "$root/logic/grades.ts";
import ImportResultPopup, {
type ImportDetail,
type ImportResult,
@@ -393,19 +398,19 @@ export default function ImportNotes() {
const ueMods = orderedCols.filter(
(c) => c.type === "module" && c.ueId === col.ueId,
);
let total = 0, coeffSum = 0;
for (const um of ueMods) {
const notesRecord: Record<string, { note: number; noteSession2: number | null }> = {};
ueMods.forEach(um => {
const n = sNotes.get(um.id);
if (n && um.coeff) {
total += n.note * um.coeff;
coeffSum += um.coeff;
}
}
row.push(
coeffSum > 0
? Math.round((total / coeffSum) * 100) / 100
: null,
if (n) notesRecord[um.id] = n;
});
const avg = calculateWeightedAverage(
ueMods.map(m => ({ idModule: m.id, coeff: m.coeff ?? 0 })),
notesRecord
);
row.push(avg !== null ? roundGrade(avg) : null);
}
}
s1Rows.push(row);
@@ -425,20 +430,19 @@ export default function ImportNotes() {
const ueMods = orderedCols.filter(
(c) => c.type === "module" && c.ueId === col.ueId,
);
let total = 0, coeffSum = 0;
for (const um of ueMods) {
const notesRecord: Record<string, { note: number; noteSession2: number | null }> = {};
ueMods.forEach(um => {
const n = sNotes.get(um.id);
if (n && um.coeff) {
const noteVal = n.noteSession2 ?? n.note;
total += noteVal * um.coeff;
coeffSum += um.coeff;
}
}
row.push(
coeffSum > 0
? Math.round((total / coeffSum) * 100) / 100
: null,
if (n) notesRecord[um.id] = n;
});
const avg = calculateWeightedAverage(
ueMods.map(m => ({ idModule: m.id, coeff: m.coeff ?? 0 })),
notesRecord
);
row.push(avg !== null ? roundGrade(avg) : null);
}
}
s2Rows.push(row);