Skip to content

Commit

Permalink
[export] export_contest: Actually convert duration int to string
Browse files Browse the repository at this point in the history
A conversion to string was intended, but never stored back in data[key]... 🙈
  • Loading branch information
mpsijm committed Dec 24, 2024
1 parent 7ea2627 commit c2224ff
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions bin/export.py
Original file line number Diff line number Diff line change
Expand Up @@ -302,12 +302,10 @@ def export_contest(cid: Optional[str]):
if not has_ryaml:
for key in ('duration', 'scoreboard_freeze_duration'):
if key in data:
value = data[key]
# YAML 1.1 parses 1:00:00 as 3600. Convert it back to a string if so.
# (YAML 1.2 parses it as a string.)
if isinstance(value, int):
str(datetime.timedelta(seconds=data[key]))
data[key] = value
# (YAML 1.2 and ruamel.yaml parse it as a string.)
if isinstance(data[key], int):
data[key] = str(datetime.timedelta(seconds=data[key]))

verbose("Uploading contest.yaml:")
verbose(data)
Expand Down

0 comments on commit c2224ff

Please sign in to comment.