diff options
author | Tudor Roman | 2019-10-07 18:48:30 +0300 |
---|---|---|
committer | Tudor Roman | 2019-10-07 18:48:30 +0300 |
commit | fc0db8c2a6ebf84775c04e962055966385bccc62 (patch) | |
tree | d3d47720c954f6d3211baeecb1f173d80c371a33 | |
parent | 68c7b1b4f44404c51a4b348351797a2b52d19831 (diff) | |
download | rmi_scripts-fc0db8c2a6ebf84775c04e962055966385bccc62.tar.gz rmi_scripts-fc0db8c2a6ebf84775c04e962055966385bccc62.zip |
added remove_participations
-rwxr-xr-x | cleanup | 2 | ||||
-rwxr-xr-x | remove_participations | 23 |
2 files changed, 24 insertions, 1 deletions
@@ -12,7 +12,7 @@ import sys from subprocess import call if len(sys.argv) != 2: - print("Usage: add_participations <csv_file> <contest_id>") + print("Usage: cleanup <csv_file>") sys.exit(1) with open(sys.argv[1]) as file: diff --git a/remove_participations b/remove_participations new file mode 100755 index 0000000..52ef5a5 --- /dev/null +++ b/remove_participations @@ -0,0 +1,23 @@ +#!/usr/bin/env python3 +# +# Removes 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(['cmsRemoveParticipation', '-c', contest_id, row['username']]) |