Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
E
edx-platform
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
edx
edx-platform
Commits
0735e5ba
Commit
0735e5ba
authored
Nov 01, 2012
by
John Jarvis
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
cleanup
parent
b5d50cb4
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
4 additions
and
16 deletions
+4
-16
lms/djangoapps/certificates/management/commands/ungenerated_certs.py
+4
-16
No files found.
lms/djangoapps/certificates/management/commands/ungenerated_certs.py
View file @
0735e5ba
from
django.utils.simplejson
import
dumps
from
django.core.management.base
import
BaseCommand
from
django.core.management.base
import
BaseCommand
,
CommandError
from
certificates.models
import
GeneratedCertificate
from
certificates.models
import
GeneratedCertificate
from
certificates.models
import
certificate_status_for_student
from
certificates.queue
import
XQueueCertInterface
from
certificates.queue
import
XQueueCertInterface
from
courseware
import
grades
,
courses
from
django.contrib.auth.models
import
User
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
):
class
Command
(
BaseCommand
):
...
@@ -26,19 +14,19 @@ class Command(BaseCommand):
...
@@ -26,19 +14,19 @@ class Command(BaseCommand):
def
handle
(
self
,
*
args
,
**
options
):
def
handle
(
self
,
*
args
,
**
options
):
course_id
=
'BerkeleyX/CS169.1x/2012_Fall'
course_id
=
'BerkeleyX/CS169.1x/2012_Fall'
course
=
courses
.
get_course_by_id
(
course_id
)
enrolled_students
=
User
.
objects
.
filter
(
enrolled_students
=
User
.
objects
.
filter
(
courseenrollment__course_id
=
course_id
)
.
prefetch_related
(
courseenrollment__course_id
=
course_id
)
.
prefetch_related
(
"groups"
)
.
order_by
(
'username'
)
"groups"
)
.
order_by
(
'username'
)
xq
=
XQueueCertInterface
()
xq
=
XQueueCertInterface
()
# delete all entries
# TODO (this is for debugging, remove)
for
c
in
GeneratedCertificate
.
objects
.
all
():
for
c
in
GeneratedCertificate
.
objects
.
all
():
c
.
delete
()
c
.
delete
()
count
=
0
count
=
0
for
student
in
enrolled_students
:
for
student
in
enrolled_students
:
ret
=
xq
.
add_cert
_to_queue
(
student
,
course_id
)
ret
=
xq
.
add_cert
(
student
,
course_id
)
if
ret
==
'generating'
:
if
ret
==
'generating'
:
print
'generating for {0}'
.
format
(
student
)
print
'generating for {0}'
.
format
(
student
)
count
+=
1
count
+=
1
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment