aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTudor Roman2020-12-02 13:12:57 +0200
committerTudor Roman2020-12-02 13:12:57 +0200
commita4e54601bd95c3be37566f6b53bef57392072eaf (patch)
tree153675b1421430e764de12269a05036e338d18ca
parent3d81f9d41d75edb358b01a4b4a90030a6e1854ef (diff)
downloadrmi_scripts-rmi2020.tar.gz
rmi_scripts-rmi2020.zip
add_participations: include name in tablermi2020
-rwxr-xr-xadd_participations8
1 files changed, 5 insertions, 3 deletions
diff --git a/add_participations b/add_participations
index 7093e7d..beb38a8 100755
--- a/add_participations
+++ b/add_participations
@@ -20,21 +20,23 @@ if len(sys.argv) != 4:
sys.exit(1)
contest_id = sys.argv[2]
-User = namedtuple('User', 'username password team_name team_id')
+User = namedtuple('User', 'first_name last_name username password team_name team_id')
users = []
with open(sys.argv[1]) as file:
reader = csv.DictReader(file, delimiter=',')
for row in reader:
password = 'p' + binascii.b2a_hex(os.urandom(6)).decode('ascii')
+ first_name = row['first_name'].strip()
+ last_name = row['last_name'].strip()
team_id = row['team_id'].strip()
team_name = row['team_name'].strip()
username = row['username'].strip()
call(['cmsAddParticipation', '-c', contest_id, '-t', team_id, '-p', password, username])
- users.append(User(username, password, team_name, team_id))
+ users.append(User(first_name, last_name, username, password, team_name, team_id))
with open(sys.argv[3], 'w') as out_file:
writer = csv.writer(out_file)
- writer.writerow(['username', 'password', 'team_name', 'team_id'])
+ writer.writerow(['first_name', 'last_name', 'username', 'password', 'team_name', 'team_id'])
for u in users:
writer.writerow(u)