-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathloadstudents.py
More file actions
executable file
·37 lines (29 loc) · 1.13 KB
/
loadstudents.py
File metadata and controls
executable file
·37 lines (29 loc) · 1.13 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
#!/usr/bin/python3
#####################################################
# #
# CompuSoft - The Compushow 2017 Software #
# #
#####################################################
# #
# - Register students. #
# #
#####################################################
import os
import sys
import django
os.environ["DJANGO_SETTINGS_MODULE"] = 'compusoft.settings'
django.setup()
from voting.library import validate_and_register_user
with open("computistas.txt", "r") as f:
registrations = 0
nr_students = 369
for line in f:
student_id = line.split()[0]
print("REGISTER: " + str(student_id))
if validate_and_register_user(student_id, True) == 'successful registration':
registrations += 1
print("SUCCESSFUL " + str(registrations) + " FROM " + str(nr_students))
else:
print("ERROR: USER NOT REGISTERED")
sys.exit()
print("REGISTERED USER: " + str(registrations) + "/" + str(nr_students))