Skip to content

Commit

Permalink
[download_submissions] Also store teams.json
Browse files Browse the repository at this point in the history
  • Loading branch information
mpsijm committed Oct 30, 2024
1 parent 379e58d commit a0fcbb8
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion bin/download_submissions.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
#!/usr/bin/env python3
import base64
import json
from os import makedirs

import config
Expand Down Expand Up @@ -27,7 +28,7 @@ def download_submissions():
if contest_id is None:
fatal("No contest ID found. Set in contest.yaml or pass --contest-id <cid>.")

bar = ProgressBar('Downloading metadata', count=3, max_len=len('submissions'))
bar = ProgressBar('Downloading metadata', count=4, max_len=len('submissions'))
bar.start('submissions')
submissions = {s["id"]: s for s in req(f"/contests/{contest_id}/submissions")}
bar.done()
Expand All @@ -37,6 +38,11 @@ def download_submissions():
len(s['team_id']) if s['team_id'].isdigit() else 0 for s in submissions.values()
)

bar.start('teams')
with open(f"submissions/teams.json", "w") as f:
f.write(json.dumps(call_api_get_json(f"/contests/{contest_id}/teams"), indent=2))
bar.done()

# Fetch account info so we can filter for team submissions
bar.start('accounts')
accounts = {a['team_id']: a for a in req(f"/contests/{contest_id}/accounts")}
Expand Down

0 comments on commit a0fcbb8

Please sign in to comment.