nopaque/web/app/results/tasks.py
2020-07-10 11:36:54 +02:00

14 lines
419 B
Python

from .. import db
from ..decorators import background
from ..models import Result
@background
def delete_result(result_id, *args, **kwargs):
with kwargs['app'].app_context():
result = Result.query.get(result_id)
if result is None:
raise Exception('Result {} not found'.format(result_id))
result.delete() # cascades down and also deletes ResultFile
db.session.commit()