Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
E
edx-platform-release
Manage
Activity
Members
Labels
Plan
Issues
0
Issue boards
Milestones
Wiki
Code
Merge requests
1
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Package Registry
Model registry
Operate
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Hsin-Yu Chien
edx-platform-release
Commits
83b79fb8
Commit
83b79fb8
authored
12 years ago
by
John Jarvis
Committed by
Carlos Andrés Rocha
12 years ago
Browse files
Options
Downloads
Patches
Plain Diff
Adding new certificate state for "notpassing"
parent
c6bfb67b
Loading
Loading
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
lms/djangoapps/certificates/models.py
+1
-0
1 addition, 0 deletions
lms/djangoapps/certificates/models.py
lms/djangoapps/certificates/queue.py
+42
-20
42 additions, 20 deletions
lms/djangoapps/certificates/queue.py
with
43 additions
and
20 deletions
lms/djangoapps/certificates/models.py
+
1
−
0
View file @
83b79fb8
...
...
@@ -45,6 +45,7 @@ class CertificateStatuses(object):
deleting
=
'
deleting
'
deleted
=
'
deleted
'
downloadable
=
'
downloadable
'
notpassing
=
'
notpassing
'
error
=
'
error
'
...
...
This diff is collapsed.
Click to expand it.
lms/djangoapps/certificates/queue.py
+
42
−
20
View file @
83b79fb8
...
...
@@ -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,16 +103,16 @@ 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
.
critical
(
"
Attempting to regenerate a certificate
"
"
for a user that doesn
'
t have one
"
)
raise
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
"
"
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
)
profile
=
UserProfile
.
objects
.
get
(
user
=
student
)
cert
,
created
=
GeneratedCertificate
.
objects
.
get_or_create
(
user
=
student
,
course_id
=
course_id
)
if
grade
[
'
grade
'
]
is
not
None
:
cert_status
=
status
.
generating
cert
,
created
=
GeneratedCertificate
.
objects
.
get_or_create
(
user
=
student
,
course_id
=
course_id
)
profile
=
UserProfile
.
objects
.
get
(
user
=
student
)
key
=
make_hashkey
(
random
.
random
())
cert
.
status
=
cert_status
cert
.
grade
=
grade
[
'
percent
'
]
cert
.
user
=
student
...
...
@@ -222,13 +238,19 @@ 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
'
)
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment