From 37164cf2ac07e29f90143b18b16a99c5f1d48222 Mon Sep 17 00:00:00 2001 From: Emanuel Almeida Date: Sat, 7 Feb 2026 21:51:44 +0000 Subject: [PATCH] feat: filtrar leads com lembrete futuro tambem no FollowUp Co-Authored-By: Claude Opus 4.6 --- api/services/dashboard.ts | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/api/services/dashboard.ts b/api/services/dashboard.ts index 14ba746..2c3adce 100644 --- a/api/services/dashboard.ts +++ b/api/services/dashboard.ts @@ -140,6 +140,10 @@ export async function getFollowupLeads() { FROM tblleads l WHERE l.status = 12 AND l.lost = 0 AND l.junk = 0 AND (SELECT MAX(date) FROM tbllead_activity_log WHERE leadid = l.id) >= DATE_SUB(CURDATE(), INTERVAL 60 DAY) + AND NOT EXISTS ( + SELECT 1 FROM tblreminders r + WHERE r.rel_id = l.id AND r.rel_type = 'lead' AND r.date > NOW() AND r.isnotified = 0 + ) ORDER BY (SELECT MAX(date) FROM tbllead_activity_log WHERE leadid = l.id) ASC `) return rows