Skip to content

Commit

Permalink
[usaco] Fix no scoring in statement bug
Browse files Browse the repository at this point in the history
  • Loading branch information
niyaznigmatullin committed Aug 14, 2020
1 parent 4a45cec commit 472c242
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 8 deletions.
2 changes: 1 addition & 1 deletion polygon_uploader/__init__.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@


__version__ = "0.2.4"
__version__ = "0.2.5"
21 changes: 14 additions & 7 deletions polygon_uploader/usaco/usaco.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,8 +81,14 @@ def extract_part(class_name):
return part

scoring = extract_part('prob-section')
if scoring is not None:
scoring = latexify_post(scoring.text, lang)
input = extract_part('prob-in-spec')
if input is not None:
input = latexify_post(input.text, lang)
output = extract_part('prob-out-spec')
if output is not None:
output = latexify_post(output.text, lang)
for x in statement.find_all_next('h4'):
x.extract()

Expand All @@ -93,9 +99,10 @@ def extract_part(class_name):
e.extract()
note = e
break

for x in note.find_all_next('pre'):
x.extract()
if note is not None:
for x in note.find_all_next('pre'):
x.extract()
note = latexify_post(note.text, lang)

# print("Legend: " + statement.text)
# print("Input: " + input.text)
Expand All @@ -106,10 +113,10 @@ def extract_part(class_name):
polygon_statement = Statement(encoding="UTF-8",
name=name,
legend=latexify_post(statement.text, lang),
input=latexify_post(input.text, lang),
output=latexify_post(output.text, lang) +
"\n\\Scoring\n" + latexify_post(scoring.text, lang),
notes=latexify_post(note.text, lang))
input=input,
output=("" if output is None else output) +
("" if scoring is None else ("\n\\Scoring\n" + scoring)),
notes=note)
prob.save_statement(lang=lang_polygon, problem_statement=polygon_statement)

def download_tests(dir, tests_dir):
Expand Down

0 comments on commit 472c242

Please sign in to comment.