Fix chal deletion (#241)

* improving get_config
* Fixing challenge deletion
* Puts challenge deletion under utils.delete_file
This commit is contained in:
Kevin Chung
2017-04-08 03:29:11 -04:00
committed by GitHub
parent b2fc5a6fcd
commit aa21a3c161
2 changed files with 4 additions and 6 deletions

View File

@@ -263,11 +263,9 @@ def admin_delete_chal():
Solves.query.filter_by(chalid=challenge.id).delete()
Keys.query.filter_by(chal=challenge.id).delete()
files = Files.query.filter_by(chal=challenge.id).all()
for f in files:
utils.delete_file(f.id)
Files.query.filter_by(chal=challenge.id).delete()
for file in files:
upload_folder = app.config['UPLOAD_FOLDER']
folder = os.path.dirname(os.path.join(os.path.normpath(app.root_path), upload_folder, file.location))
utils.rmdir(folder)
Tags.query.filter_by(chal=challenge.id).delete()
Challenges.query.filter_by(id=challenge.id).delete()
db.session.commit()