From 5488d90b62976704e9f1e4466b0169a036dbc534 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Arod?= Date: Mon, 2 Sep 2024 14:53:30 +0200 Subject: [PATCH] feat: make compute stats more robust by excluding pages with title "Famile de resistant" --- src/notion/fetch/fetchFamiliesWithEventsFromNotion.ts | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/notion/fetch/fetchFamiliesWithEventsFromNotion.ts b/src/notion/fetch/fetchFamiliesWithEventsFromNotion.ts index 7e2f97e..efb5043 100644 --- a/src/notion/fetch/fetchFamiliesWithEventsFromNotion.ts +++ b/src/notion/fetch/fetchFamiliesWithEventsFromNotion.ts @@ -34,12 +34,14 @@ export async function fetchFamiliesWithEventsFromNotion( return buildFamilyEvent(pageObjectResponse); }); - const families: Famille[] = await Promise.all( + const familles: Famille[] = await Promise.all( familyPages.map((pageObjectResponse) => { return buildFamily(pageObjectResponse, familyEvents); }) ); - return families; + // Fix to remove the empty "Famille de résistant" page that is often created by mistake + const filtered = familles.filter(f => f.Titre !== "Famille de résistant"); + return filtered; } function buildFamilyEvent(page: PageObjectResponse): EvenementFamille {