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
4cda8044
Commit
4cda8044
authored
Aug 02, 2017
by
Sanford Student
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add cert available date to lms
for EDUCATOR-525
parent
4f25d1aa
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
53 additions
and
2 deletions
+53
-2
lms/djangoapps/courseware/courses.py
+3
-1
lms/djangoapps/courseware/date_summary.py
+23
-0
lms/djangoapps/courseware/tests/test_date_summary.py
+27
-1
No files found.
lms/djangoapps/courseware/courses.py
View file @
4cda8044
...
...
@@ -15,7 +15,8 @@ from courseware.date_summary import (
CourseStartDate
,
TodaysDate
,
VerificationDeadlineDate
,
VerifiedUpgradeDeadlineDate
VerifiedUpgradeDeadlineDate
,
CertificateAvailableDate
)
from
courseware.model_data
import
FieldDataCache
from
courseware.module_render
import
get_module
...
...
@@ -367,6 +368,7 @@ def get_course_date_blocks(course, user):
sorted by date.
"""
block_classes
=
(
CertificateAvailableDate
,
CourseEndDate
,
CourseStartDate
,
TodaysDate
,
...
...
lms/djangoapps/courseware/date_summary.py
View file @
4cda8044
...
...
@@ -16,6 +16,7 @@ from pytz import timezone, utc
from
course_modes.models
import
CourseMode
from
lms.djangoapps.commerce.utils
import
EcommerceService
from
lms.djangoapps.verify_student.models
import
SoftwareSecurePhotoVerification
,
VerificationDeadline
from
openedx.core.djangoapps.certificates.config
import
waffle
from
student.models
import
CourseEnrollment
...
...
@@ -195,6 +196,28 @@ class CourseEndDate(DateSummary):
return
self
.
course
.
end
class
CertificateAvailableDate
(
DateSummary
):
"""
Displays the end date of the course.
"""
css_class
=
'certificate-available-date'
title
=
ugettext_lazy
(
'Certificate Available'
)
@property
def
is_enabled
(
self
):
return
self
.
date
is
not
None
and
datetime
.
datetime
.
now
(
utc
)
<=
self
.
date
and
waffle
.
waffle
()
.
is_enabled
(
waffle
.
INSTRUCTOR_PACED_ONLY
)
@property
def
description
(
self
):
return
_
(
'Day certificates will become available for passing verified learners.'
)
@property
def
date
(
self
):
return
self
.
course
.
certificate_available_date
class
VerifiedUpgradeDeadlineDate
(
DateSummary
):
"""
Displays the date before which learners must upgrade to the
...
...
lms/djangoapps/courseware/tests/test_date_summary.py
View file @
4cda8044
...
...
@@ -18,7 +18,8 @@ from courseware.date_summary import (
CourseStartDate
,
TodaysDate
,
VerificationDeadlineDate
,
VerifiedUpgradeDeadlineDate
VerifiedUpgradeDeadlineDate
,
CertificateAvailableDate
)
from
courseware.models
import
DynamicUpgradeDeadlineConfiguration
,
CourseDynamicUpgradeDeadlineConfiguration
from
lms.djangoapps.verify_student.models
import
VerificationDeadline
...
...
@@ -351,6 +352,31 @@ class CourseDateSummaryTest(SharedModuleStoreTestCase):
block
=
VerifiedUpgradeDeadlineDate
(
course
,
user
)
self
.
assertEqual
(
block
.
link
,
'{}?sku={}'
.
format
(
configuration
.
MULTIPLE_ITEMS_BASKET_PAGE_URL
,
sku
))
## CertificateAvailableDate
@waffle.testutils.override_switch
(
'certificates.instructor_paced_only'
,
True
)
def
test_no_certificate_available_date
(
self
):
course
=
self
.
create_course_run
(
days_till_start
=-
1
)
user
=
self
.
create_user
()
CourseEnrollmentFactory
(
course_id
=
course
.
id
,
user
=
user
,
mode
=
CourseMode
.
AUDIT
)
block
=
CertificateAvailableDate
(
course
,
user
)
self
.
assertEqual
(
block
.
date
,
None
)
self
.
assertFalse
(
block
.
is_enabled
)
@waffle.testutils.override_switch
(
'certificates.instructor_paced_only'
,
True
)
def
test_certificate_available_date_defined
(
self
):
course
=
self
.
create_course_run
()
audit_user
=
self
.
create_user
()
CourseEnrollmentFactory
(
course_id
=
course
.
id
,
user
=
audit_user
,
mode
=
CourseMode
.
AUDIT
)
verified_user
=
self
.
create_user
()
CourseEnrollmentFactory
(
course_id
=
course
.
id
,
user
=
verified_user
,
mode
=
CourseMode
.
VERIFIED
)
course
.
certificate_available_date
=
datetime
.
now
(
utc
)
+
timedelta
(
days
=
7
)
course
.
save
()
CertificateAvailableDate
(
course
,
audit_user
)
for
block
in
(
CertificateAvailableDate
(
course
,
audit_user
),
CertificateAvailableDate
(
course
,
verified_user
)):
self
.
assertIsNotNone
(
course
.
certificate_available_date
)
self
.
assertEqual
(
block
.
date
,
course
.
certificate_available_date
)
self
.
assertTrue
(
block
.
is_enabled
)
## VerificationDeadlineDate
def
test_no_verification_deadline
(
self
):
course
=
self
.
create_course_run
(
days_till_start
=-
1
,
days_till_verification_deadline
=
None
)
...
...
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