Skip to content

Commit

Permalink
allow duplicate team in csv
Browse files Browse the repository at this point in the history
  • Loading branch information
leduythuccs committed Oct 20, 2023
1 parent 0bdfd26 commit 40791e1
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions judge/management/commands/batch_add_icpc_team.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,12 +71,17 @@ def handle(self, *args, **options):
writer = csv.DictWriter(fout, fieldnames=['username', 'teamname', 'password'])
writer.writeheader()

done_team_ids = set()

for cnt, row in enumerate(reader, start=1):
username = f'{prefix}{cnt}'
teamname = row['name']
org = get_org(row['instName'])
password = generate_password()
internalid = row['id']
if internalid in done_team_ids:
continue
done_team_ids.add(internalid)

add_user(username, teamname, password, org, internalid)

Expand Down

0 comments on commit 40791e1

Please sign in to comment.