删除比赛题目暂时不删除测试用例

This commit is contained in:
virusdefender 2019-09-22 15:05:02 +08:00
parent c392cbd0d9
commit 0401468ff3

View File

@ -430,9 +430,9 @@ class ContestProblemAPI(ProblemBase):
ensure_created_by(problem.contest, request.user) ensure_created_by(problem.contest, request.user)
if Submission.objects.filter(problem=problem).exists(): if Submission.objects.filter(problem=problem).exists():
return self.error("Can't delete the problem as it has submissions") return self.error("Can't delete the problem as it has submissions")
d = os.path.join(settings.TEST_CASE_DIR, problem.test_case_id) # d = os.path.join(settings.TEST_CASE_DIR, problem.test_case_id)
if os.path.isdir(d): # if os.path.isdir(d):
shutil.rmtree(d, ignore_errors=True) # shutil.rmtree(d, ignore_errors=True)
problem.delete() problem.delete()
return self.success() return self.success()