mirror of
https://github.com/FAUSheppy/icinga-webhook-gateway
synced 2026-06-19 03:32:37 +02:00
fix: reuse status_list_query
This commit is contained in:
@@ -199,6 +199,7 @@ def service_details():
|
||||
return ("Services is not owned by {}".format(user))
|
||||
|
||||
two_weeks_ago_ts = int((datetime.datetime.now() - datetime.timedelta(days=14)).timestamp())
|
||||
status_list_query = db.session.query(Status).filter(Status.service==service.service)
|
||||
recent_query = (
|
||||
status_list_query
|
||||
.filter(Status.timestamp >= two_weeks_ago_ts, Status.service==service.service)
|
||||
@@ -207,7 +208,6 @@ def service_details():
|
||||
status_list = recent_query.all()
|
||||
|
||||
if not recent_entries:
|
||||
status_list_query = db.session.query(Status).filter(Status.service==service.service)
|
||||
status_list = status_list_query.order_by(sqlalchemy.desc(Status.timestamp)).limit(1000).all()
|
||||
|
||||
# build status tupel (repeats, status) #
|
||||
|
||||
Reference in New Issue
Block a user