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
711e2e7f
Commit
711e2e7f
authored
Feb 04, 2016
by
Peter Fogg
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Correctly set certificate status for audit certs when regenerating.
COR-2403
parent
21218ef9
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
16 additions
and
7 deletions
+16
-7
lms/djangoapps/certificates/queue.py
+5
-3
lms/djangoapps/certificates/tests/test_queue.py
+11
-4
No files found.
lms/djangoapps/certificates/queue.py
View file @
711e2e7f
...
...
@@ -323,9 +323,11 @@ class XQueueCertInterface(object):
# If this user's enrollment is not eligible to receive a
# certificate, mark it as such for reporting and
# analytics. Only do this if the certificate is new -- we
# don't want to mark existing audit certs as ineligible.
if
created
and
not
is_eligible_for_certificate
:
# analytics. Only do this if the certificate is new, or
# already marked as ineligible -- we don't want to mark
# existing audit certs as ineligible.
if
(
created
or
cert
.
status
in
(
CertificateStatuses
.
audit_passing
,
CertificateStatuses
.
audit_notpassing
))
\
and
not
is_eligible_for_certificate
:
cert
.
status
=
CertificateStatuses
.
audit_passing
if
passing
else
CertificateStatuses
.
audit_notpassing
cert
.
save
()
LOGGER
.
info
(
...
...
lms/djangoapps/certificates/tests/test_queue.py
View file @
711e2e7f
...
...
@@ -205,7 +205,14 @@ class XQueueCertInterfaceAddCertificateTest(ModuleStoreTestCase):
else
:
self
.
assertFalse
(
mock_send
.
called
)
def
test_regen_audit_certs_eligibility
(
self
):
@ddt.data
(
(
CertificateStatuses
.
downloadable
,
'Pass'
,
CertificateStatuses
.
generating
),
(
CertificateStatuses
.
audit_passing
,
'Pass'
,
CertificateStatuses
.
audit_passing
),
(
CertificateStatuses
.
audit_notpassing
,
'Pass'
,
CertificateStatuses
.
audit_passing
),
(
CertificateStatuses
.
audit_notpassing
,
None
,
CertificateStatuses
.
audit_notpassing
),
)
@ddt.unpack
def
test_regen_audit_certs_eligibility
(
self
,
status
,
grade
,
expected_status
):
"""
Test that existing audit certificates remain eligible even if cert
generation is re-run.
...
...
@@ -221,19 +228,19 @@ class XQueueCertInterfaceAddCertificateTest(ModuleStoreTestCase):
user
=
self
.
user_2
,
course_id
=
self
.
course
.
id
,
grade
=
'1.0'
,
status
=
CertificateStatuses
.
downloadable
,
status
=
status
,
mode
=
GeneratedCertificate
.
MODES
.
audit
,
)
# Run grading/cert generation again
with
patch
(
'courseware.grades.grade'
,
Mock
(
return_value
=
{
'grade'
:
'Pass'
,
'percent'
:
0.75
})):
with
patch
(
'courseware.grades.grade'
,
Mock
(
return_value
=
{
'grade'
:
grade
,
'percent'
:
0.75
})):
with
patch
.
object
(
XQueueInterface
,
'send_to_queue'
)
as
mock_send
:
mock_send
.
return_value
=
(
0
,
None
)
self
.
xqueue
.
add_cert
(
self
.
user_2
,
self
.
course
.
id
)
self
.
assertEqual
(
GeneratedCertificate
.
objects
.
get
(
user
=
self
.
user_2
,
course_id
=
self
.
course
.
id
)
.
status
,
# pylint: disable=no-member
CertificateStatuses
.
generating
expected_status
)
...
...
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