From 0c3d3ac0a96c73b0f12bd452a166223a005841f5 Mon Sep 17 00:00:00 2001 From: "gpt-engineer-app[bot]" <159125892+gpt-engineer-app[bot]@users.noreply.github.com> Date: Fri, 10 Oct 2025 17:35:55 +0000 Subject: [PATCH] Fix company generation pluralization --- supabase/functions/seed-test-data/index.ts | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/supabase/functions/seed-test-data/index.ts b/supabase/functions/seed-test-data/index.ts index 147db1e2..53413da8 100644 --- a/supabase/functions/seed-test-data/index.ts +++ b/supabase/functions/seed-test-data/index.ts @@ -334,10 +334,21 @@ Deno.serve(async (req) => { return { submissionId, itemId, typeId: null }; } + // Helper function to properly pluralize company types + const pluralizeCompanyType = (singular: string): string => { + const pluralMap: Record = { + 'manufacturer': 'manufacturers', + 'operator': 'operators', + 'designer': 'designers', + 'property_owner': 'property_owners' + }; + return pluralMap[singular] || singular + 's'; + }; + // Create companies FIRST so parks can reference operators/owners const companyTypes = ['manufacturer', 'operator', 'designer', 'property_owner']; for (const compType of companyTypes) { - if (entityTypes.includes(compType + 's') || entityTypes.includes(compType === 'manufacturer' ? 'manufacturers' : compType === 'property_owner' ? 'property_owners' : compType + 's')) { + if (entityTypes.includes(pluralizeCompanyType(compType))) { const count = Math.floor(plan.companies / 4); for (let i = 0; i < count; i++) { const level = getPopulationLevel(fieldDensity, i);