aboutsummaryrefslogtreecommitdiff
path: root/add_participations
blob: 32c10e5f6faeda6ffc6d4dd1a9e6e915519eee19 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
#!/usr/bin/env python3
#
# Adds participations into CMS
#
# Made by Tudor Roman, public domain
#
# This script expects as its first argument a table generated by add_users.
# The second argument is the id of the contest.
#

import csv
import sys
from subprocess import call

if len(sys.argv) != 3:
    print("Usage: add_participations <csv_file> <contest_id>")
    sys.exit(1)

contest_id = sys.argv[2]

with open(sys.argv[1]) as file:
    reader = csv.DictReader(file, delimiter=',')
    for row in reader:
        call(['cmsAddParticipation', '-c', contest_id, '-t', row['team_id'], row['username']])