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
dfbcd84e
Commit
dfbcd84e
authored
Jan 14, 2016
by
Peter Fogg
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #11234 from edx/peter-fogg/new-audit-certs
Ensure old audit certs don't get marked ineligible.
parents
e74fe37e
54c349b4
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
36 additions
and
4 deletions
+36
-4
lms/djangoapps/certificates/queue.py
+4
-3
lms/djangoapps/certificates/tests/test_queue.py
+32
-1
No files found.
lms/djangoapps/certificates/queue.py
View file @
dfbcd84e
...
...
@@ -279,7 +279,7 @@ class XQueueCertInterface(object):
if
forced_grade
:
grade
[
'grade'
]
=
forced_grade
cert
,
__
=
GeneratedCertificate
.
eligible_certificates
.
get_or_create
(
user
=
student
,
course_id
=
course_id
)
cert
,
created
=
GeneratedCertificate
.
eligible_certificates
.
get_or_create
(
user
=
student
,
course_id
=
course_id
)
cert
.
mode
=
cert_mode
cert
.
user
=
student
...
...
@@ -290,8 +290,9 @@ class XQueueCertInterface(object):
# If this user's enrollment is not eligible to receive a
# certificate, mark it as such for reporting and
# analytics.
if
not
is_eligible_for_certificate
:
# 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
:
cert
.
eligible_for_certificate
=
False
cert
.
status
=
CertificateStatuses
.
auditing
cert
.
save
()
...
...
lms/djangoapps/certificates/tests/test_queue.py
View file @
dfbcd84e
...
...
@@ -30,7 +30,7 @@ from certificates.models import (
CertificateStatuses
,
)
from
certificates.queue
import
XQueueCertInterface
from
certificates.tests.factories
import
CertificateWhitelistFactory
from
certificates.tests.factories
import
CertificateWhitelistFactory
,
GeneratedCertificateFactory
from
lms.djangoapps.verify_student.tests.factories
import
SoftwareSecurePhotoVerificationFactory
...
...
@@ -205,6 +205,37 @@ class XQueueCertInterfaceAddCertificateTest(ModuleStoreTestCase):
else
:
self
.
assertFalse
(
mock_send
.
called
)
def
test_old_audit_cert_eligible
(
self
):
"""
Test that existing audit certificates remain eligible even if cert
generation is re-run.
"""
# Create an existing audit enrollment and certificate
CourseEnrollmentFactory
(
user
=
self
.
user_2
,
course_id
=
self
.
course
.
id
,
is_active
=
True
,
mode
=
CourseMode
.
AUDIT
,
)
GeneratedCertificateFactory
(
user
=
self
.
user_2
,
course_id
=
self
.
course
.
id
,
grade
=
'1.0'
,
status
=
CertificateStatuses
.
downloadable
,
mode
=
GeneratedCertificate
.
MODES
.
audit
,
eligible_for_certificate
=
True
,
)
# Run grading/cert generation again
with
patch
(
'courseware.grades.grade'
,
Mock
(
return_value
=
{
'grade'
:
'Pass'
,
'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
.
assertTrue
(
GeneratedCertificate
.
objects
.
get
(
user
=
self
.
user_2
,
course_id
=
self
.
course
.
id
)
.
eligible_for_certificate
# pylint: disable=no-member
)
@attr
(
'shard_1'
)
@override_settings
(
CERT_QUEUE
=
'certificates'
)
...
...
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