mirror of
https://github.com/pacnpal/thrilltrack-explorer.git
synced 2025-12-20 19:31:14 -05:00
Fix company generation pluralization
This commit is contained in:
@@ -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<string, string> = {
|
||||
'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);
|
||||
|
||||
Reference in New Issue
Block a user