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
e39451a9
Unverified
Commit
e39451a9
authored
Oct 31, 2017
by
Awais Jibran
Committed by
GitHub
Oct 31, 2017
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #16376 from edx/aj/cleanup-and-logging
Import Cleanup and Adding Logging message
parents
b0fd8e23
abe8b7e7
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
10 additions
and
3 deletions
+10
-3
lms/djangoapps/courseware/views/views.py
+10
-3
No files found.
lms/djangoapps/courseware/views/views.py
View file @
e39451a9
...
...
@@ -5,12 +5,11 @@ import json
import
logging
import
urllib
from
collections
import
OrderedDict
,
namedtuple
from
datetime
import
datetime
,
timedelta
from
datetime
import
datetime
import
analytics
import
shoppingcart
import
survey.views
import
waffle
from
certificates
import
api
as
certs_api
from
certificates.models
import
CertificateStatuses
from
commerce.utils
import
EcommerceService
...
...
@@ -69,7 +68,6 @@ from markupsafe import escape
from
opaque_keys
import
InvalidKeyError
from
opaque_keys.edx.keys
import
CourseKey
,
UsageKey
from
openedx.core.djangoapps.catalog.utils
import
get_programs
,
get_programs_with_type
from
openedx.core.djangoapps.certificates
import
api
as
auto_certs_api
from
openedx.core.djangoapps.content.course_overviews.models
import
CourseOverview
from
openedx.core.djangoapps.credit.api
import
(
get_credit_requirement_status
,
...
...
@@ -1343,10 +1341,19 @@ def generate_user_cert(request, course_id):
return
HttpResponseBadRequest
(
_
(
"Course is not valid"
))
if
not
is_course_passed
(
student
,
course
):
log
.
info
(
u"User
%
s has not passed the course:
%
s"
,
student
.
username
,
course_id
)
return
HttpResponseBadRequest
(
_
(
"Your certificate will be available when you pass the course."
))
certificate_status
=
certs_api
.
certificate_downloadable_status
(
student
,
course
.
id
)
log
.
info
(
u"User
%
s has requested for certificate in
%
s, current status: is_downloadable:
%
s, is_generating:
%
s"
,
student
.
username
,
course_id
,
certificate_status
[
"is_downloadable"
],
certificate_status
[
"is_generating"
],
)
if
certificate_status
[
"is_downloadable"
]:
return
HttpResponseBadRequest
(
_
(
"Certificate has already been created."
))
elif
certificate_status
[
"is_generating"
]:
...
...
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