From 855af334691300237d863d8d42f098fe4b5f2194 Mon Sep 17 00:00:00 2001
From: Alessandro Bortolin
Date: Mon, 25 Nov 2024 20:54:50 +0100
Subject: [PATCH 1/3] Minor fixes
---
src/cli/firebase/import.ts | 2 ++
src/web/teacher/table.tsx | 8 ++++----
2 files changed, 6 insertions(+), 4 deletions(-)
diff --git a/src/cli/firebase/import.ts b/src/cli/firebase/import.ts
index 38de0c3..237411b 100644
--- a/src/cli/firebase/import.ts
+++ b/src/cli/firebase/import.ts
@@ -225,6 +225,7 @@ async function importUsers(users: User[], customClaims: object, options: ImportO
let user = await auth.getUserByEmail(record.email).catch(noop);
if (!user) {
user = await auth.createUser({
+ uid: record.id,
email: record.email,
emailVerified: true,
password: record.password,
@@ -305,6 +306,7 @@ async function importVariantMappings(db: Firestore, options: ImportOptions) {
}
const userSchema = z.object({
+ id: z.string().optional(),
name: z.string(),
email: z.string().email(),
password: z.string(),
diff --git a/src/web/teacher/table.tsx b/src/web/teacher/table.tsx
index 5abe44b..ee7e659 100644
--- a/src/web/teacher/table.tsx
+++ b/src/web/teacher/table.tsx
@@ -113,13 +113,13 @@ const FinalizeModal = forwardRef(function FinalizeModal(
// Generate a list of string that can uniquely identify a student. Multiple
// strings are generated to prevent possible errors during data entry.
function normalize(student: Student) {
- const info = student.userData!;
+ const info = student.userData;
const orderings = [
["name", "surname", "classYear", "classSection"],
["surname", "name", "classYear", "classSection"],
];
return orderings.map((fields) => {
- return deburr(fields.map((field) => info[field]).join("\n"))
+ return deburr(fields.map((field) => info?.[field] ?? "").join("\n"))
.toLowerCase()
.replaceAll(/[^\w\n]/g, "");
});
@@ -247,7 +247,7 @@ const DeleteModal = forwardRef(function DeleteModal(
Seleziona tutti” come filtro.