Skip to content

Commit

Permalink
Fix skip to submission option for replay script.
Browse files Browse the repository at this point in the history
Also ignore submissions without ID.
  • Loading branch information
Nicky Gerritsen committed Mar 16, 2024
1 parent 8bb162c commit 336d60c
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion provision-contest/replay.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
from zipfile import ZipFile
from datetime import datetime
from datetime import timedelta
from itertools import dropwhile
import time
import sys
import random
Expand Down Expand Up @@ -84,7 +85,7 @@
first_submission_time = 0
if args.submissionid:
skip_to_submission = args.submissionid
submissions = submissions[skip_to_submission:]
submissions = list(dropwhile(lambda s: s['id'] != skip_to_submission, submissions))
logging.info(f'Skipped to submission {skip_to_submission}, {len(submissions)} remaining.')
first_submission_time = (datetime.strptime(submissions[0]['contest_time'][:-4], '%H:%M:%S') - datetime(1900, 1, 1)).total_seconds()
orig_contest_duration -= first_submission_time
Expand Down Expand Up @@ -115,6 +116,8 @@

submissions_api_url = f'{api_url}/contests/{contest}/submissions'
for submission in submissions:
if not submission['id']:
continue
times = submission['contest_time'].split(':')
orig_submission_time = int(times[0])*3600 + int(times[1])*60 + float(times[2])
new_submission_time = orig_submission_time/simulation_speed
Expand Down

0 comments on commit 336d60c

Please sign in to comment.