From 56a579ff910d81830a9821133df85c6cbc30074b Mon Sep 17 00:00:00 2001 From: Ian Philips Date: Fri, 22 Jul 2022 16:44:03 -0600 Subject: [PATCH] Don't filter for group contract ids --- functions/src/scripts/link-contracts-to-groups.ts | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/functions/src/scripts/link-contracts-to-groups.ts b/functions/src/scripts/link-contracts-to-groups.ts index a61c6c6c..e3296160 100644 --- a/functions/src/scripts/link-contracts-to-groups.ts +++ b/functions/src/scripts/link-contracts-to-groups.ts @@ -14,18 +14,11 @@ const addGroupIdToContracts = async () => { const groups = await getValues(adminFirestore.collection('groups')) for (const group of groups) { - const contracts = await getValues( + const groupContracts = await getValues( adminFirestore .collection('contracts') .where('groupSlugs', 'array-contains', group.slug) ) - const groupContracts = contracts.filter((contract) => - group.contractIds.includes(contract.id) - ) - if (groupContracts.length !== contracts.length) - console.log( - `Found ${groupContracts.length} contracts for group ${group.slug}` - ) for (const contract of groupContracts) { const oldGroupLinks = contract.groupLinks?.filter(