Fix pretest wrong testcases

This commit is contained in:
cuom1999 2020-05-29 15:46:17 -05:00
parent 6da7630ba5
commit 388715bf3a

View file

@ -165,11 +165,17 @@ def get_problem_data(submission):
archive = zipfile.ZipFile(archive_path, 'r') archive = zipfile.ZipFile(archive_path, 'r')
except zipfile.BadZipfile: except zipfile.BadZipfile:
raise Exception('bad archive: "%s"' % archive_path) raise Exception('bad archive: "%s"' % archive_path)
testcases = ProblemTestCase.objects.filter(dataset=submission.problem)\ testcases = ProblemTestCase.objects.filter(dataset=submission.problem)\
.order_by('order') .order_by('order')
if (submission.is_pretested):
testcases = testcases.filter(is_pretest=True)
problem_data = {}
for count, case in enumerate(testcases):
problem_data[count + 1] = get_input_answer(case, archive)
problem_data = {case.order: get_input_answer(case, archive)
for case in testcases}
return problem_data return problem_data