Commit 3a6bb0cd by Piotr Mitros

Properly logging

parent 385a87c7
......@@ -65,6 +65,8 @@ Will log what happened to file.txt.
group_objects = {}
f = open(args[1],"a+")
## Create groups
for group in dict(groups):
utg = UserTestGroup()
......@@ -76,11 +78,22 @@ Will log what happened to file.txt.
## Assign groups
users = list(User.objects.all())
count = 0
for user in users:
if count % 1000 == 0:
print count
count = count + 1
v = random.uniform(0,1)
group = group_from_value(groups,v)
group_objects[group].users.add(user)
f.write("Assigned user {name} ({id}) to {group}\n".format(name=user.username,
id=user.id,
group=group))
## Save groups
for group in group_objects:
group_objects[group].save()
f.close()
# python manage.py assigngroups summary_test:0.3,skip_summary_test:0.7 log.txt "Do previews of future materials help?"
# python manage.py assigngroups skip_capacitor:0.3,capacitor:0.7 log.txt "Do we show capacitor in linearity tutorial?"
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment