Skip to content

Commit

Permalink
Compute score on imported students
Browse files Browse the repository at this point in the history
  • Loading branch information
bortoz committed Dec 7, 2024
1 parent 172be44 commit f3dfafc
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/web/teacher/table-importer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import {
type Participation,
type Student,
type Variant,
calcScore,
parseUserData,
studentSchema,
} from "~/models";
Expand Down Expand Up @@ -158,7 +159,7 @@ async function importStudents(
userData[field.name] = validated;
}

return {
const student: Student = {
id: randomId(),
userData,
contestId: contest.id,
Expand All @@ -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();
Expand Down

0 comments on commit f3dfafc

Please sign in to comment.