Skip to content

Commit 3cb5c15

Browse files
authored
Merge pull request #2 from judge0/hermanzdosilovic/wait
Use get_submission for one submission in wait.
2 parents 1ba646d + db96c83 commit 3cb5c15

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

src/judge0/api.py

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,15 @@ def wait(
7575
}
7676

7777
while len(submissions_to_check) > 0 and not retry_mechanism.is_done():
78-
client.get_submissions(submissions_to_check.values())
78+
# We differentiate between getting a single submission and multiple
79+
# submissions to be consistent with the API, even though the API
80+
# allows to get single submission with the same endpoint as for getting
81+
# the multiple submissions.
82+
if len(submissions_to_check) == 1:
83+
client.get_submission(*submissions_to_check.values())
84+
else:
85+
client.get_submissions(submissions_to_check.values())
86+
7987
for token in list(submissions_to_check):
8088
submission = submissions_to_check[token]
8189
if submission.is_done():

0 commit comments

Comments
 (0)