From 04dc02280d628ce3a096e74c00d66c683b3e951e Mon Sep 17 00:00:00 2001 From: Jake Kasper Date: Fri, 5 Sep 2025 11:35:54 -0400 Subject: [PATCH] asdfasdf --- backend/src/routes/properties.js | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/backend/src/routes/properties.js b/backend/src/routes/properties.js index 987a85c..5e1f168 100644 --- a/backend/src/routes/properties.js +++ b/backend/src/routes/properties.js @@ -312,7 +312,8 @@ router.delete('/:id', validateParams(idParamSchema), async (req, res, next) => { const activeApps = await pool.query( `SELECT COUNT(*) as count FROM application_plans ap - JOIN lawn_sections ls ON ap.lawn_section_id = ls.id + JOIN application_plan_sections aps ON ap.id = aps.plan_id + JOIN lawn_sections ls ON aps.lawn_section_id = ls.id WHERE ls.property_id = $1 AND ap.status IN ('planned', 'in_progress')`, [propertyId] ); @@ -507,8 +508,9 @@ router.delete('/:propertyId/sections/:sectionId', async (req, res, next) => { // Check for active applications const activeApps = await pool.query( `SELECT COUNT(*) as count - FROM application_plans - WHERE lawn_section_id = $1 AND status IN ('planned', 'in_progress')`, + FROM application_plans ap + JOIN application_plan_sections aps ON ap.id = aps.plan_id + WHERE aps.lawn_section_id = $1 AND ap.status IN ('planned', 'in_progress')`, [sectionId] );