Skip to content

Commit

Permalink
Fix submit_polygon_solutions
Browse files Browse the repository at this point in the history
  • Loading branch information
hieplpvip committed Aug 1, 2024
1 parent 7bf2f5e commit 80ecce9
Showing 1 changed file with 3 additions and 22 deletions.
25 changes: 3 additions & 22 deletions judge/management/commands/submit_polygon_solutions.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,38 +48,19 @@ def handle(self, *args, **options):
if source_lang.startswith('cpp'):
header = '/*\n' + '\n'.join(comments) + '\n*/\n\n'
source_code = header + package.read(source_path).decode('utf-8')
language = Language.objects.get(key='CPP20')
language = Language.objects.get(key='CPPICPC')
elif source_lang.startswith('java'):
header = '/*\n' + '\n'.join(comments) + '\n*/\n\n'
source_code = header + package.read(source_path).decode('utf-8')
language = Language.objects.get(key='JAVA')
elif source_lang.startswith('pas'):
header = '{\n' + '\n'.join(comments) + '\n}\n\n'
source_code = header + package.read(source_path).decode('utf-8')
language = Language.objects.get(key='PAS')
elif source_lang.startswith('python'):
elif source_lang.startswith('python.pypy3') or source_lang == 'python.3':
header = '"""\n' + '\n'.join(comments) + '\n"""\n\n'
source_code = header + package.read(source_path).decode('utf-8')
if source_lang == 'python.pypy2':
language = Language.objects.get(key='PYPY')
elif source_lang.startswith('python.pypy3'):
language = Language.objects.get(key='PYPY3')
elif source_lang == 'python.2':
language = Language.objects.get(key='PY2')
else:
language = Language.objects.get(key='PY3')
language = Language.objects.get(key='PYPY3')
elif source_lang.startswith('kotlin'):
header = '/*\n' + '\n'.join(comments) + '\n*/\n\n'
source_code = header + package.read(source_path).decode('utf-8')
language = Language.objects.get(key='KOTLIN')
elif source_lang == 'go':
header = '/*\n' + '\n'.join(comments) + '\n*/\n\n'
source_code = header + package.read(source_path).decode('utf-8')
language = Language.objects.get(key='GO')
elif source_lang == 'rust':
header = '/*\n' + '\n'.join(comments) + '\n*/\n\n'
source_code = header + package.read(source_path).decode('utf-8')
language = Language.objects.get(key='RUST')
else:
print('Unsupported language', source_lang)
continue
Expand Down

0 comments on commit 80ecce9

Please sign in to comment.