From f3dfafc8685633961c1b667828172b3531797b5f Mon Sep 17 00:00:00 2001 From: Alessandro Bortolin Date: Sat, 7 Dec 2024 19:41:14 +0100 Subject: [PATCH] Compute score on imported students --- src/web/teacher/table-importer.tsx | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/web/teacher/table-importer.tsx b/src/web/teacher/table-importer.tsx index 09d299e..3ef9167 100644 --- a/src/web/teacher/table-importer.tsx +++ b/src/web/teacher/table-importer.tsx @@ -10,6 +10,7 @@ import { type Participation, type Student, type Variant, + calcScore, parseUserData, studentSchema, } from "~/models"; @@ -158,7 +159,7 @@ async function importStudents( userData[field.name] = validated; } - return { + const student: Student = { id: randomId(), userData, contestId: contest.id, @@ -169,7 +170,9 @@ async function importStudents( createdAt: new Date(), absent: false, disabled: false, - } as Student; + }; + student.score = calcScore(student, variants[variantId]?.schema); + return student; }) .pipe(studentSchema) .array();