From 83b626fd4d3ca0b0004daac62572c64848425814 Mon Sep 17 00:00:00 2001 From: Chinemerem Date: Mon, 25 Nov 2024 02:07:18 -0800 Subject: [PATCH] Correctly seed notes half the time --- prisma/seed/seed.ts | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/prisma/seed/seed.ts b/prisma/seed/seed.ts index cbcc853..73e8109 100644 --- a/prisma/seed/seed.ts +++ b/prisma/seed/seed.ts @@ -129,14 +129,17 @@ const main = async () => { ); await seed.absence((createMany) => - createMany(10, () => ({ - lessonDate: faker.date.future(), - lessonPlan: faker.internet.url(), - reasonOfAbsence: faker.lorem.sentence(), - notes: faker.helpers.maybe(() => faker.lorem.paragraph(), { + createMany(10, () => { + const maybeNotes = faker.helpers.maybe(() => faker.lorem.paragraph(), { probability: 0.5, - }), - })) + }); + return { + lessonDate: faker.date.future(), + lessonPlan: faker.internet.url(), + reasonOfAbsence: faker.lorem.sentence(), + notes: maybeNotes ?? null, + }; + }) ); await seed.mailingList((createMany) =>