Commit 0735e5ba by John Jarvis

cleanup

parent b5d50cb4
from django.utils.simplejson import dumps
from django.core.management.base import BaseCommand, CommandError
from django.core.management.base import BaseCommand
from certificates.models import GeneratedCertificate
from certificates.models import certificate_status_for_student
from certificates.queue import XQueueCertInterface
from courseware import grades, courses
from django.contrib.auth.models import User
from django.test.client import RequestFactory
from capa.xqueue_interface import XQueueInterface
from capa.xqueue_interface import make_xheader, make_hashkey
from django.conf import settings
from requests.auth import HTTPBasicAuth
from student.models import UserProfile
import json
import random
import logging
class Command(BaseCommand):
......@@ -26,19 +14,19 @@ class Command(BaseCommand):
def handle(self, *args, **options):
course_id = 'BerkeleyX/CS169.1x/2012_Fall'
course = courses.get_course_by_id(course_id)
enrolled_students = User.objects.filter(
courseenrollment__course_id=course_id).prefetch_related(
"groups").order_by('username')
xq = XQueueCertInterface()
# delete all entries
# TODO (this is for debugging, remove)
for c in GeneratedCertificate.objects.all():
c.delete()
count = 0
for student in enrolled_students:
ret = xq.add_cert_to_queue(student, course_id)
ret = xq.add_cert(student, course_id)
if ret == 'generating':
print 'generating for {0}'.format(student)
count += 1
......
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