console.log und noten In Deutsch un Mathe als Nummer pruefen
This commit is contained in:
@@ -5,8 +5,6 @@ import { json } from '@sveltejs/kit';
|
|||||||
|
|
||||||
const prisma = new PrismaClient();
|
const prisma = new PrismaClient();
|
||||||
|
|
||||||
console.log(prisma.anmeldung.create);
|
|
||||||
|
|
||||||
export async function POST({ request }) {
|
export async function POST({ request }) {
|
||||||
const formData = await request.formData();
|
const formData = await request.formData();
|
||||||
|
|
||||||
@@ -15,6 +13,12 @@ export async function POST({ request }) {
|
|||||||
const pdfs = formData.getAll('pdfs') as File[];
|
const pdfs = formData.getAll('pdfs') as File[];
|
||||||
|
|
||||||
const gespeichertePfade: string[] = [];
|
const gespeichertePfade: string[] = [];
|
||||||
|
const noteDeutsch = Number(get('noteDeutsch'));
|
||||||
|
const noteMathe = Number(get('noteMathe'));
|
||||||
|
|
||||||
|
if (isNaN(noteDeutsch) || isNaN(noteMathe)) {
|
||||||
|
return json({ error: 'Bitte gib gültige Noten an.' }, { status: 400 });
|
||||||
|
}
|
||||||
|
|
||||||
for (const pdf of pdfs) {
|
for (const pdf of pdfs) {
|
||||||
if (pdf.size > 0 && pdf.type === 'application/pdf') {
|
if (pdf.size > 0 && pdf.type === 'application/pdf') {
|
||||||
@@ -24,6 +28,14 @@ export async function POST({ request }) {
|
|||||||
await writeFile(`static${pfad}`, buffer);
|
await writeFile(`static${pfad}`, buffer);
|
||||||
gespeichertePfade.push(pfad);
|
gespeichertePfade.push(pfad);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
console.log({
|
||||||
|
noteDeutsch: get('noteDeutsch'),
|
||||||
|
noteMathe: get('noteMathe'),
|
||||||
|
parsedDeutsch: parseFloat(get('noteDeutsch')),
|
||||||
|
parsedMathe: parseFloat(get('noteMathe')),
|
||||||
|
});
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
@@ -39,8 +51,8 @@ export async function POST({ request }) {
|
|||||||
plz: get('plz'),
|
plz: get('plz'),
|
||||||
telefon: get('telefon'),
|
telefon: get('telefon'),
|
||||||
email: get('email'),
|
email: get('email'),
|
||||||
noteDeutsch: parseFloat(get('noteDeutsch')),
|
noteDeutsch,
|
||||||
noteMathe: parseFloat(get('noteMathe')),
|
noteMathe,
|
||||||
sozialverhalten: get('sozialverhalten'),
|
sozialverhalten: get('sozialverhalten'),
|
||||||
praktikumId: Number(formData.get('praktikumId')),
|
praktikumId: Number(formData.get('praktikumId')),
|
||||||
schulart: get('schulart'),
|
schulart: get('schulart'),
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
Binary file not shown.
Binary file not shown.
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user