diff --git a/keep/api/core/db.py b/keep/api/core/db.py index 47129dd20..d30fc0047 100644 --- a/keep/api/core/db.py +++ b/keep/api/core/db.py @@ -4302,7 +4302,6 @@ def is_all_alerts_in_status( Alert.fingerprint == AlertEnrichment.alert_fingerprint ), ) - .having(func.max(Alert.timestamp)) ) if fingerprints: @@ -4332,10 +4331,10 @@ def is_all_alerts_in_status( .select_from(subquery) .where( or_( - subquery.c.enriched_status != status, + subquery.c.enriched_status != status.value, and_( subquery.c.enriched_status.is_(None), - subquery.c.status != status, + subquery.c.status != status.value, ), ) ) diff --git a/keep/rulesengine/rulesengine.py b/keep/rulesengine/rulesengine.py index 08b4770b8..711134fc1 100644 --- a/keep/rulesengine/rulesengine.py +++ b/keep/rulesengine/rulesengine.py @@ -18,7 +18,8 @@ add_alerts_to_incident, is_all_alerts_resolved, is_first_incident_alert_resolved, - is_last_incident_alert_resolved, is_all_alerts_in_status, + is_last_incident_alert_resolved, + is_all_alerts_in_status, ) from keep.api.core.db import get_rules as get_rules_db from keep.api.models.alert import AlertDto, AlertSeverity, IncidentDto, IncidentStatus, AlertStatus