Skip to content

Commit

Permalink
fix: limit and offset
Browse files Browse the repository at this point in the history
  • Loading branch information
talboren authored and VladimirFilonov committed Oct 31, 2024
1 parent 0adc920 commit a0740c3
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions keep/api/core/db.py
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand All @@ -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

Expand Down

0 comments on commit a0740c3

Please sign in to comment.