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
13d738fb
Commit
13d738fb
authored
7 years ago
by
Awais Jibran
Browse files
Options
Downloads
Patches
Plain Diff
Improving logging over generate cert button on progress page.
EDUCATOR-2017.
parent
e67171b8
Loading
Loading
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
openedx/core/djangoapps/certificates/api.py
+28
-3
28 additions, 3 deletions
openedx/core/djangoapps/certificates/api.py
with
28 additions
and
3 deletions
openedx/core/djangoapps/certificates/api.py
+
28
−
3
View file @
13d738fb
"""
The public API for certificates.
"""
import
logging
from
datetime
import
datetime
from
pytz
import
UTC
...
...
@@ -9,6 +10,7 @@ from certificates.models import CertificateWhitelist
from
openedx.core.djangoapps.certificates.config
import
waffle
from
student.models
import
CourseEnrollment
log
=
logging
.
getLogger
(
__name__
)
SWITCHES
=
waffle
.
waffle
()
...
...
@@ -56,10 +58,33 @@ def is_certificate_valid(certificate):
def
can_show_certificate_message
(
course
,
student
,
course_grade
,
certificates_enabled_for_course
):
is_whitelisted
=
CertificateWhitelist
.
objects
.
filter
(
user
=
student
,
course_id
=
course
.
id
,
whitelist
=
True
).
exists
()
auto_cert_gen_enabled
=
auto_certificate_generation_enabled
()
has_active_enrollment
=
CourseEnrollment
.
is_enrolled
(
student
,
course
.
id
)
certificates_are_viewable
=
certificates_viewable_for_course
(
course
)
# Adding a temporary logging for EDUCATOR-2017.
if
unicode
(
course
.
id
)
==
u
'
course-v1:RITx+PM9004x+3T2017
'
:
log
.
info
(
(
u
'
can_show_certificate_message called with:
'
u
'
course:%s, student: %s, course grade: %s,
'
u
'
certificates_enabled_for_course: %s, certificates_viewable_for_course: %s, auto_cert_gen_enabled: %s,
'
u
'
has_active_enrollment: %s, passed: %s, is_whitelisted: %s
'
),
course
.
id
,
student
.
username
,
course_grade
,
certificates_enabled_for_course
,
certificates_are_viewable
,
auto_cert_gen_enabled
,
has_active_enrollment
,
course_grade
.
passed
,
is_whitelisted
)
if
not
(
(
auto_cert
ificate_generatio
n_enabled
()
or
certificates_enabled_for_course
)
and
CourseEnrollment
.
is_enrolled
(
student
,
course
.
id
)
and
certificates_viewable
_for_course
(
course
)
and
(
auto_cert
_ge
n_enabled
or
certificates_enabled_for_course
)
and
has_active_enrollment
and
certificates_
are_
viewable
and
(
course_grade
.
passed
or
is_whitelisted
)
):
return
False
...
...
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