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(