mirror of
https://github.com/pds-nest/nest.git
synced 2024-11-25 14:34:19 +00:00
Fix bug that prevented alert to be deleted
This commit is contained in:
parent
4f274fa9af
commit
37132489e2
1 changed files with 8 additions and 1 deletions
|
@ -175,9 +175,16 @@ def page_alert(aid):
|
||||||
return json_success(alert.to_json()), 200
|
return json_success(alert.to_json()), 200
|
||||||
elif request.method == "DELETE":
|
elif request.method == "DELETE":
|
||||||
try:
|
try:
|
||||||
|
for elem in alert.conditions:
|
||||||
|
condition = elem.condition
|
||||||
|
ext.session.delete(elem)
|
||||||
|
ext.session.commit()
|
||||||
|
if not condition.repository_id:
|
||||||
|
ext.session.delete(condition)
|
||||||
|
ext.session.commit()
|
||||||
ext.session.delete(alert)
|
ext.session.delete(alert)
|
||||||
ext.session.commit()
|
ext.session.commit()
|
||||||
except Exception:
|
except Exception as e:
|
||||||
return json_error("Something went wrong while deleting alert.", ALERT_DELETION_FAILURE), 500
|
return json_error("Something went wrong while deleting alert.", ALERT_DELETION_FAILURE), 500
|
||||||
return json_success("Deletion completed."), 204
|
return json_success("Deletion completed."), 204
|
||||||
elif request.method == "PUT":
|
elif request.method == "PUT":
|
||||||
|
|
Loading…
Reference in a new issue