mirror of
https://github.com/pacnpal/thrilltrack-explorer.git
synced 2025-12-21 17:31:12 -05:00
Fix: Ensure all entity types are generated
This commit is contained in:
@@ -303,7 +303,10 @@ Deno.serve(async (req) => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const { error: subError } = await supabase.from('content_submissions').insert(submissionData);
|
const { error: subError } = await supabase.from('content_submissions').insert(submissionData);
|
||||||
if (subError) throw subError;
|
if (subError) {
|
||||||
|
console.error(`Error inserting content_submission for type ${type}:`, subError);
|
||||||
|
throw subError;
|
||||||
|
}
|
||||||
|
|
||||||
const { error: itemError } = await supabase.from('submission_items').insert({
|
const { error: itemError } = await supabase.from('submission_items').insert({
|
||||||
id: itemId,
|
id: itemId,
|
||||||
@@ -334,7 +337,11 @@ Deno.serve(async (req) => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const { data: insertedData, error: typeError } = await supabase.from(table).insert(typeData).select('id').single();
|
const { data: insertedData, error: typeError } = await supabase.from(table).insert(typeData).select('id').single();
|
||||||
if (typeError) throw typeError;
|
if (typeError) {
|
||||||
|
console.error(`Error inserting into ${table} for type ${type}:`, typeError);
|
||||||
|
console.error('Data being inserted:', JSON.stringify(typeData, null, 2));
|
||||||
|
throw typeError;
|
||||||
|
}
|
||||||
return { submissionId, itemId, typeId: insertedData?.id };
|
return { submissionId, itemId, typeId: insertedData?.id };
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -435,8 +442,13 @@ Deno.serve(async (req) => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Create parks
|
// Create parks
|
||||||
|
console.log(`\n=== PARK GENERATION ===`);
|
||||||
|
console.log(`entityTypes includes parks: ${entityTypes.includes('parks')}`);
|
||||||
|
console.log(`plan.parks: ${plan.parks}`);
|
||||||
|
|
||||||
if (entityTypes.includes('parks')) {
|
if (entityTypes.includes('parks')) {
|
||||||
for (let i = 0; i < plan.parks; i++) {
|
for (let i = 0; i < plan.parks; i++) {
|
||||||
|
console.log(` Creating park ${i + 1}/${plan.parks}`);
|
||||||
const level = getPopulationLevel(fieldDensity, i);
|
const level = getPopulationLevel(fieldDensity, i);
|
||||||
const shouldConflict = includeConflicts && createdParkSlugs.length > 0 && Math.random() < 0.15;
|
const shouldConflict = includeConflicts && createdParkSlugs.length > 0 && Math.random() < 0.15;
|
||||||
const shouldVersionChain = includeVersionChains && createdParkSlugs.length > 0 && Math.random() < 0.15;
|
const shouldVersionChain = includeVersionChains && createdParkSlugs.length > 0 && Math.random() < 0.15;
|
||||||
|
|||||||
Reference in New Issue
Block a user