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
70762d1a
Commit
70762d1a
authored
Feb 04, 2014
by
Jason Bau
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #2307 from edx/jbau/allow-unset-course-startdate
Handle taking registrations on a course with TBD start date
parents
3f43fb64
7ac13bf8
Show whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
46 additions
and
17 deletions
+46
-17
CHANGELOG.rst
+4
-0
common/lib/xmodule/xmodule/course_module.py
+17
-3
common/lib/xmodule/xmodule/tests/test_course_module.py
+16
-10
lms/static/sass/shared/_course_object.scss
+3
-3
lms/templates/course.html
+2
-0
lms/templates/courseware/course_about.html
+2
-1
lms/templates/dashboard/_dashboard_course_listing.html
+2
-0
No files found.
CHANGELOG.rst
View file @
70762d1a
...
...
@@ -5,6 +5,10 @@ These are notable changes in edx-platform. This is a rolling list of changes,
in roughly chronological order, most recent first. Add your entries at or near
the top. Include a label indicating the component affected.
LMS: If the course start date is kept at the default studio value (Jan 1, 2030)
and advertised_start is not set, the start date is not displayed in the
/courses tile view, the course about page, or the dashboard
Blades: Add role parameter to LTI. BLD-583.
Blades: Bugfix "In Firefox YouTube video with start time plays from 00:00:00".
...
...
common/lib/xmodule/xmodule/course_module.py
View file @
70762d1a
...
...
@@ -824,6 +824,10 @@ class CourseDescriptor(CourseFields, SequenceDescriptor):
@property
def
start_date_text
(
self
):
"""
Returns the desired text corresponding the course's start date. Prefers .advertised_start,
then falls back to .start
"""
def
try_parse_iso_8601
(
text
):
try
:
result
=
Date
()
.
from_json
(
text
)
...
...
@@ -838,13 +842,23 @@ class CourseDescriptor(CourseFields, SequenceDescriptor):
if
isinstance
(
self
.
advertised_start
,
basestring
):
return
try_parse_iso_8601
(
self
.
advertised_start
)
elif
self
.
advertised_start
is
None
and
self
.
start
is
None
:
# TODO this is an impossible state since the init function forces start to have a value
return
'TBD'
elif
self
.
start_date_is_still_default
:
_
=
self
.
runtime
.
service
(
self
,
"i18n"
)
.
ugettext
# Translators: TBD stands for 'To Be Determined' and is used when a course
# does not yet have an announced start date.
return
_
(
'TBD'
)
else
:
return
(
self
.
advertised_start
or
self
.
start
)
.
strftime
(
"
%
b
%
d,
%
Y"
)
@property
def
start_date_is_still_default
(
self
):
"""
Checks if the start date set for the course is still default, i.e. .start has not been modified,
and .advertised_start has not been set.
"""
return
self
.
advertised_start
is
None
and
self
.
start
==
CourseFields
.
start
.
default
@property
def
end_date_text
(
self
):
"""
Returns the end date for the course formatted as a string.
...
...
common/lib/xmodule/xmodule/tests/test_course_module.py
View file @
70762d1a
...
...
@@ -134,23 +134,29 @@ class IsNewCourseTestCase(unittest.TestCase):
print
"Comparing
%
s to
%
s"
%
(
a
,
b
)
assertion
(
a_score
,
b_score
)
start_advertised_settings
=
[
# start, advertised, result, is_still_default
(
'2012-12-02T12:00'
,
None
,
'Dec 02, 2012'
,
False
),
(
'2012-12-02T12:00'
,
'2011-11-01T12:00'
,
'Nov 01, 2011'
,
False
),
(
'2012-12-02T12:00'
,
'Spring 2012'
,
'Spring 2012'
,
False
),
(
'2012-12-02T12:00'
,
'November, 2011'
,
'November, 2011'
,
False
),
(
xmodule
.
course_module
.
CourseFields
.
start
.
default
,
None
,
'TBD'
,
True
),
(
xmodule
.
course_module
.
CourseFields
.
start
.
default
,
'January 2014'
,
'January 2014'
,
False
),
]
@patch
(
'xmodule.course_module.datetime.now'
)
def
test_start_date_text
(
self
,
gmtime_mock
):
gmtime_mock
.
return_value
=
NOW
settings
=
[
# start, advertized, result
(
'2012-12-02T12:00'
,
None
,
'Dec 02, 2012'
),
(
'2012-12-02T12:00'
,
'2011-11-01T12:00'
,
'Nov 01, 2011'
),
(
'2012-12-02T12:00'
,
'Spring 2012'
,
'Spring 2012'
),
(
'2012-12-02T12:00'
,
'November, 2011'
,
'November, 2011'
),
]
for
s
in
settings
:
for
s
in
self
.
start_advertised_settings
:
d
=
get_dummy_course
(
start
=
s
[
0
],
advertised_start
=
s
[
1
])
print
"Checking start=
%
s advertised=
%
s"
%
(
s
[
0
],
s
[
1
])
self
.
assertEqual
(
d
.
start_date_text
,
s
[
2
])
def
test_start_date_is_default
(
self
):
for
s
in
self
.
start_advertised_settings
:
d
=
get_dummy_course
(
start
=
s
[
0
],
advertised_start
=
s
[
1
])
self
.
assertEqual
(
d
.
start_date_is_still_default
,
s
[
3
])
def
test_display_organization
(
self
):
descriptor
=
get_dummy_course
(
start
=
'2012-12-02T12:00'
,
is_new
=
True
)
self
.
assertNotEqual
(
descriptor
.
location
.
org
,
descriptor
.
display_org_with_default
)
...
...
lms/static/sass/shared/_course_object.scss
View file @
70762d1a
...
...
@@ -226,14 +226,14 @@
width
:
100%
;
.university
{
border-right
:
1px
solid
$border-color-2
;
color
:
$lighter-base-font-color
;
letter-spacing
:
1px
;
margin-right
:
10px
;
padding-right
:
10px
;
}
.start-date
{
border-left
:
1px
solid
$border-color-2
;
margin-left
:
5px
;
padding-left
:
10px
;
color
:
$lighter-base-font-color
;
letter-spacing
:
1px
;
}
...
...
lms/templates/course.html
View file @
70762d1a
...
...
@@ -26,7 +26,9 @@ from courseware.courses import course_image_url, get_course_about_section
</div>
<div
class=
"bottom"
>
<span
class=
"university"
>
${get_course_about_section(course, 'university')}
</span>
% if not course.start_date_is_still_default:
<span
class=
"start-date"
>
${course.start_date_text}
</span>
% endif
</div>
</section>
</div>
...
...
lms/templates/courseware/course_about.html
View file @
70762d1a
...
...
@@ -256,8 +256,9 @@
<ol
class=
"important-dates"
>
<li><div
class=
"icon course-number"
></div><p>
${_("Course Number")}
</p><span
class=
"course-number"
>
${course.display_number_with_default | h}
</span></li>
% if not course.start_date_is_still_default:
<li><div
class=
"icon start"
></div><p>
${_("Classes Start")}
</p><span
class=
"start-date"
>
${course.start_date_text}
</span></li>
% endif
## We plan to ditch end_date (which is not stored in course metadata),
## but for backwards compatibility, show about/end_date blob if it exists.
% if get_course_about_section(course, "end_date") or course.end:
...
...
lms/templates/dashboard/_dashboard_course_listing.html
View file @
70762d1a
...
...
@@ -43,6 +43,8 @@
${_("Course Completed - {end_date}").format(end_date=course.end_date_text)}
% elif course.has_started():
${_("Course Started - {start_date}").format(start_date=course.start_date_text)}
% elif course.start_date_is_still_default: # Course start date TBD
${_("Course has not yet started")}
% else: # hasn't started yet
${_("Course Starts - {start_date}").format(start_date=course.start_date_text)}
% endif
...
...
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