aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTudor Roman2019-10-07 18:48:30 +0300
committerTudor Roman2019-10-07 18:48:30 +0300
commitfc0db8c2a6ebf84775c04e962055966385bccc62 (patch)
treed3d47720c954f6d3211baeecb1f173d80c371a33
parent68c7b1b4f44404c51a4b348351797a2b52d19831 (diff)
downloadrmi_scripts-fc0db8c2a6ebf84775c04e962055966385bccc62.tar.gz
rmi_scripts-fc0db8c2a6ebf84775c04e962055966385bccc62.zip
added remove_participations
-rwxr-xr-xcleanup2
-rwxr-xr-xremove_participations23
2 files changed, 24 insertions, 1 deletions
diff --git a/cleanup b/cleanup
index fb25e2c..04f98cc 100755
--- a/cleanup
+++ b/cleanup
@@ -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']])