From a0740c3c459dfc1a3f3c0d574224eaf19fb22b28 Mon Sep 17 00:00:00 2001 From: Tal Borenstein Date: Wed, 30 Oct 2024 00:46:30 +0200 Subject: [PATCH] fix: limit and offset --- keep/api/core/db.py | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/keep/api/core/db.py b/keep/api/core/db.py index 6976faa3a..acf8e61f5 100644 --- a/keep/api/core/db.py +++ b/keep/api/core/db.py @@ -3225,6 +3225,7 @@ def get_incident_alerts_and_links_by_incident_id( AlertToIncident.incident_id == incident_id, ) .order_by(col(Alert.timestamp).desc()) + .options(joinedload(Alert.alert_enrichment)) ) if not include_unlinked: query = query.filter( @@ -3233,10 +3234,8 @@ def get_incident_alerts_and_links_by_incident_id( total_count = query.count() - if limit: - query = query.limit(limit) - if offset: - query = query.offset(offset) + if limit is not None and offset is not None: + query = query.limit(limit).offset(offset) return query.all(), total_count