asdfasdf
This commit is contained in:
@@ -312,7 +312,8 @@ router.delete('/:id', validateParams(idParamSchema), async (req, res, next) => {
|
|||||||
const activeApps = await pool.query(
|
const activeApps = await pool.query(
|
||||||
`SELECT COUNT(*) as count
|
`SELECT COUNT(*) as count
|
||||||
FROM application_plans ap
|
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')`,
|
WHERE ls.property_id = $1 AND ap.status IN ('planned', 'in_progress')`,
|
||||||
[propertyId]
|
[propertyId]
|
||||||
);
|
);
|
||||||
@@ -507,8 +508,9 @@ router.delete('/:propertyId/sections/:sectionId', async (req, res, next) => {
|
|||||||
// Check for active applications
|
// Check for active applications
|
||||||
const activeApps = await pool.query(
|
const activeApps = await pool.query(
|
||||||
`SELECT COUNT(*) as count
|
`SELECT COUNT(*) as count
|
||||||
FROM application_plans
|
FROM application_plans ap
|
||||||
WHERE lawn_section_id = $1 AND status IN ('planned', 'in_progress')`,
|
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]
|
[sectionId]
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user