0
0
Fork 0
mirror of https://github.com/alerta/alerta.git synced 2025-05-16 06:11:39 +00:00

Get the canonical alert id when query history by id ()

This commit is contained in:
Nick Satterly 2020-01-18 22:12:13 +01:00 committed by GitHub
parent a8e66b457b
commit 8889a9a8c7
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 9 additions and 1 deletions
alerta/database/backends/postgres

View file

@ -89,7 +89,7 @@ class QueryBuilderImpl(QueryBuilder):
# id
ids = params.getlist('id')
if len(ids) == 1:
query.append('AND (id LIKE %(id)s OR last_receive_id LIKE %(id)s)')
query.append('AND (alerts.id LIKE %(id)s OR last_receive_id LIKE %(id)s)')
qvars['id'] = ids[0] + '%'
elif ids:
query.append('AND (id ~* (%(regex_id)s) OR last_receive_id ~* (%(regex_id)s))')