Delete graders when deleting problems
This commit is contained in:
parent
19d9fe32eb
commit
a94df0dd49
1 changed files with 3 additions and 0 deletions
|
@ -1,6 +1,7 @@
|
||||||
import hashlib
|
import hashlib
|
||||||
import logger
|
import logger
|
||||||
import os
|
import os
|
||||||
|
import shutil
|
||||||
import utils
|
import utils
|
||||||
|
|
||||||
from flask import Blueprint, jsonify, session, request
|
from flask import Blueprint, jsonify, session, request
|
||||||
|
@ -68,6 +69,8 @@ def problem_delete():
|
||||||
if problem:
|
if problem:
|
||||||
Solves.query.filter_by(pid=pid).delete()
|
Solves.query.filter_by(pid=pid).delete()
|
||||||
Problems.query.filter_by(pid=pid).delete()
|
Problems.query.filter_by(pid=pid).delete()
|
||||||
|
grader_folder = "/".join(problem.grader.split("/")[:-1])
|
||||||
|
shutil.rmtree(grader_folder)
|
||||||
db.session.commit()
|
db.session.commit()
|
||||||
return { "success": 1, "message": "Success!" }
|
return { "success": 1, "message": "Success!" }
|
||||||
raise WebException("Problem does not exist!")
|
raise WebException("Problem does not exist!")
|
||||||
|
|
Loading…
Reference in a new issue