Skip to content

Commit

Permalink
bugfix: loading test-cases in txt will not produce a first "ghost" en…
Browse files Browse the repository at this point in the history
…try using a folder as input source.
  • Loading branch information
FherStk committed Dec 24, 2023
1 parent 75a7381 commit eb0a63e
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 5 deletions.
4 changes: 2 additions & 2 deletions judge/models/problem_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -183,8 +183,8 @@ def load_test_cases_from_zip(self, *args, **kwargs):
tc.delete()

files = sorted(ZipFile(self.zipfile).namelist())
input = [x for x in files if '.in' in x or 'input' in x]
output = [x for x in files if '.out' in x or 'output' in x]
input = [x for x in files if '.in' in x or ('input' in x and '.' in x)]
output = [x for x in files if '.out' in x or ('output' in x and '.' in x)]

cases = []
for i in range(len(input)):
Expand Down
5 changes: 2 additions & 3 deletions judge/views/problem_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -212,9 +212,8 @@ def post(self, request, *args, **kwargs):
case.save()

# Once loaded all the test cases (from zip or manually), the content can be setup
if data.problem.include_test_cases:
data.setup_test_cases_content()
data.problem.save()
data.setup_test_cases_content()
data.problem.save()

ProblemDataCompiler.generate(problem, data, problem.cases.order_by('order'), valid_files)
return HttpResponseRedirect(request.get_full_path())
Expand Down

0 comments on commit eb0a63e

Please sign in to comment.