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
efed8c03
Commit
efed8c03
authored
Nov 09, 2012
by
Victor Shnayder
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #1031 from MITx/feature/jarv/cert-updates
Feature/jarv/cert updates
parents
5d62e46e
7675da2b
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
39 additions
and
15 deletions
+39
-15
lms/djangoapps/certificates/models.py
+1
-0
lms/djangoapps/certificates/queue.py
+37
-15
lms/envs/aws.py
+1
-0
No files found.
lms/djangoapps/certificates/models.py
View file @
efed8c03
...
...
@@ -45,6 +45,7 @@ class CertificateStatuses(object):
deleting
=
'deleting'
deleted
=
'deleted'
downloadable
=
'downloadable'
notpassing
=
'notpassing'
error
=
'error'
...
...
lms/djangoapps/certificates/queue.py
View file @
efed8c03
...
...
@@ -82,7 +82,12 @@ class XQueueCertInterface(object):
the certificate status to 'regenerating'.
Certificate must be in the 'error' or 'downloadable' state
and the student must have a passing grade.
If the student has a passing grade a certificate
request will be put on the queue
If the student is not passing his state will change
to status.notpassing
otherwise it will return the current state
...
...
@@ -98,17 +103,17 @@ class XQueueCertInterface(object):
course
=
courses
.
get_course_by_id
(
course_id
)
grade
=
grades
.
grade
(
student
,
self
.
request
,
course
)
if
grade
[
'grade'
]
is
not
None
:
profile
=
UserProfile
.
objects
.
get
(
user
=
student
)
try
:
cert
=
GeneratedCertificate
.
objects
.
get
(
user
=
student
,
course_id
=
course_id
)
except
GeneratedCertificate
.
DoesNotExist
:
logger
.
warning
(
"Attempting to regenerate a certificate"
logger
.
critical
(
"Attempting to regenerate a certificate"
"for a user that doesn't have one"
)
raise
if
grade
[
'grade'
]
is
not
None
:
cert
.
status
=
status
.
regenerating
cert
.
name
=
profile
.
name
...
...
@@ -125,6 +130,11 @@ class XQueueCertInterface(object):
self
.
_send_to_xqueue
(
contents
,
key
)
cert
.
save
()
else
:
cert
.
status
=
status
.
notpassing
cert
.
name
=
profile
.
name
cert
.
save
()
return
cert_status
def
del_cert
(
self
,
student
,
course_id
):
...
...
@@ -182,14 +192,20 @@ class XQueueCertInterface(object):
Will change the certificate status to 'deleting'.
Certificate must be in the 'unavailable', 'error',
or 'deleted' state and the student must have
a passing grade.
or 'deleted' state.
otherwise it will return the current state
If a student has a passing grade a request will made
for a new cert
If a student does not have a passing grade the status
will change to status.notpassing
Returns the student's status
"""
VALID_STATUSES
=
[
status
.
unavailable
,
status
.
deleted
,
status
.
error
]
VALID_STATUSES
=
[
status
.
unavailable
,
status
.
deleted
,
status
.
error
,
status
.
notpassing
]
cert_status
=
certificate_status_for_student
(
student
,
course_id
)[
'status'
]
...
...
@@ -198,14 +214,14 @@ class XQueueCertInterface(object):
# grade the student
course
=
courses
.
get_course_by_id
(
course_id
)
grade
=
grades
.
grade
(
student
,
self
.
request
,
course
)
if
grade
[
'grade'
]
is
not
None
:
cert_status
=
status
.
generating
profile
=
UserProfile
.
objects
.
get
(
user
=
student
)
cert
,
created
=
GeneratedCertificate
.
objects
.
get_or_create
(
user
=
student
,
course_id
=
course_id
)
profile
=
UserProfile
.
objects
.
get
(
user
=
student
)
if
grade
[
'grade'
]
is
not
None
:
cert_status
=
status
.
generating
key
=
make_hashkey
(
random
.
random
())
cert
.
status
=
cert_status
cert
.
grade
=
grade
[
'percent'
]
cert
.
user
=
student
...
...
@@ -222,16 +238,22 @@ class XQueueCertInterface(object):
self
.
_send_to_xqueue
(
contents
,
key
)
cert
.
save
()
else
:
cert_status
=
status
.
notpassing
cert
.
status
=
cert_status
cert
.
user
=
student
cert
.
course_id
=
course_id
cert
.
name
=
profile
.
name
cert
.
save
()
return
cert_status
def
_send_to_xqueue
(
self
,
contents
,
key
):
# TODO - need to read queue name from settings
xheader
=
make_xheader
(
'http://{0}/update_certificate?{1}'
.
format
(
settings
.
SITE_NAME
,
key
),
key
,
'test-pull'
)
settings
.
SITE_NAME
,
key
),
key
,
settings
.
CERT_QUEUE
)
(
error
,
msg
)
=
self
.
xqueue_interface
.
send_to_queue
(
header
=
xheader
,
body
=
json
.
dumps
(
contents
))
...
...
lms/envs/aws.py
View file @
efed8c03
...
...
@@ -59,6 +59,7 @@ COURSE_LISTINGS = ENV_TOKENS.get('COURSE_LISTINGS', {})
SUBDOMAIN_BRANDING
=
ENV_TOKENS
.
get
(
'SUBDOMAIN_BRANDING'
,
{})
COMMENTS_SERVICE_URL
=
ENV_TOKENS
.
get
(
"COMMENTS_SERVICE_URL"
,
''
)
COMMENTS_SERVICE_KEY
=
ENV_TOKENS
.
get
(
"COMMENTS_SERVICE_KEY"
,
''
)
CERT_QUEUE
=
ENV_TOKENS
.
get
(
"CERT_QUEUE"
,
'test-pull'
)
############################## SECURE AUTH ITEMS ###############################
# Secret things: passwords, access keys, etc.
...
...
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