Skip to content
This repository was archived by the owner on Sep 3, 2025. It is now read-only.

Commit f1e3229

Browse files
authored
Always return all incidents (#2255)
1 parent 9452739 commit f1e3229

File tree

1 file changed

+2
-12
lines changed

1 file changed

+2
-12
lines changed

src/dispatch/incident/service.py

Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -100,22 +100,18 @@ def get_all(*, db_session, project_id: int) -> List[Optional[Incident]]:
100100
return db_session.query(Incident).filter(Incident.project_id == project_id)
101101

102102

103-
def get_all_by_status(
104-
*, db_session, status: str, project_id: int, skip=0, limit=100
105-
) -> List[Optional[Incident]]:
103+
def get_all_by_status(*, db_session, status: str, project_id: int) -> List[Optional[Incident]]:
106104
"""Returns all incidents based on the given status."""
107105
return (
108106
db_session.query(Incident)
109107
.filter(Incident.status == status)
110108
.filter(Incident.project_id == project_id)
111-
.offset(skip)
112-
.limit(limit)
113109
.all()
114110
)
115111

116112

117113
def get_all_last_x_hours_by_status(
118-
*, db_session, status: str, hours: int, project_id: int, skip=0, limit=100
114+
*, db_session, status: str, hours: int, project_id: int
119115
) -> List[Optional[Incident]]:
120116
"""Returns all incidents of a given status in the last x hours."""
121117
now = datetime.utcnow()
@@ -126,8 +122,6 @@ def get_all_last_x_hours_by_status(
126122
.filter(Incident.status == IncidentStatus.active)
127123
.filter(Incident.created_at >= now - timedelta(hours=hours))
128124
.filter(Incident.project_id == project_id)
129-
.offset(skip)
130-
.limit(limit)
131125
.all()
132126
)
133127

@@ -137,8 +131,6 @@ def get_all_last_x_hours_by_status(
137131
.filter(Incident.status == IncidentStatus.stable)
138132
.filter(Incident.stable_at >= now - timedelta(hours=hours))
139133
.filter(Incident.project_id == project_id)
140-
.offset(skip)
141-
.limit(limit)
142134
.all()
143135
)
144136

@@ -148,8 +140,6 @@ def get_all_last_x_hours_by_status(
148140
.filter(Incident.status == IncidentStatus.closed)
149141
.filter(Incident.closed_at >= now - timedelta(hours=hours))
150142
.filter(Incident.project_id == project_id)
151-
.offset(skip)
152-
.limit(limit)
153143
.all()
154144
)
155145

0 commit comments

Comments
 (0)