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
2c984719
Commit
2c984719
authored
Dec 19, 2017
by
Anthony Mangano
Committed by
Michael LoTurco
Dec 20, 2017
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ensure enrollment_end is parsed to datetime prior to making comparisons
parent
5a8579d3
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
14 additions
and
13 deletions
+14
-13
common/djangoapps/student/tests/test_views.py
+12
-12
common/djangoapps/student/views.py
+2
-1
No files found.
common/djangoapps/student/tests/test_views.py
View file @
2c984719
...
...
@@ -361,7 +361,7 @@ class StudentDashboardTests(SharedModuleStoreTestCase, MilestonesTestCaseMixin):
mock_course_runs
.
return_value
=
[
{
'key'
:
'course-v1:FAKE+FA1-MA1.X+3T2017'
,
'enrollment_end'
:
s
elf
.
TOMORROW
,
'enrollment_end'
:
s
tr
(
self
.
TOMORROW
)
,
'pacing_type'
:
'instructor_paced'
,
'type'
:
'verified'
}
...
...
@@ -389,7 +389,7 @@ class StudentDashboardTests(SharedModuleStoreTestCase, MilestonesTestCaseMixin):
mock_course_runs
.
return_value
=
[
{
'key'
:
'course-v1:FAKE+FA1-MA1.X+3T2017'
,
'enrollment_end'
:
s
elf
.
TOMORROW
,
'enrollment_end'
:
s
tr
(
self
.
TOMORROW
)
,
'pacing_type'
:
'instructor_paced'
,
'type'
:
'verified'
}
...
...
@@ -416,8 +416,8 @@ class StudentDashboardTests(SharedModuleStoreTestCase, MilestonesTestCaseMixin):
course_enrollment
=
CourseEnrollmentFactory
(
user
=
self
.
user
,
course_id
=
unicode
(
mocked_course_overview
.
id
))
mock_course_runs
.
return_value
=
[
{
'key'
:
mocked_course_overview
.
id
,
'enrollment_end'
:
mocked_course_overview
.
enrollment_end
,
'key'
:
str
(
mocked_course_overview
.
id
)
,
'enrollment_end'
:
str
(
mocked_course_overview
.
enrollment_end
)
,
'pacing_type'
:
'self_paced'
,
'type'
:
'verified'
}
...
...
@@ -434,8 +434,8 @@ class StudentDashboardTests(SharedModuleStoreTestCase, MilestonesTestCaseMixin):
mock_course_key
.
return_value
=
mocked_course_overview
.
id
mock_course_runs
.
return_value
=
[
{
'key'
:
mocked_course_overview
.
id
,
'enrollment_end'
:
mocked_course_overview
.
enrollment_end
,
'key'
:
str
(
mocked_course_overview
.
id
)
,
'enrollment_end'
:
str
(
mocked_course_overview
.
enrollment_end
)
,
'pacing_type'
:
'self_paced'
,
'type'
:
'verified'
}
...
...
@@ -451,8 +451,8 @@ class StudentDashboardTests(SharedModuleStoreTestCase, MilestonesTestCaseMixin):
mock_course_key
.
return_value
=
mocked_course_overview
.
id
mock_course_runs
.
return_value
=
[
{
'key'
:
mocked_course_overview
.
id
,
'enrollment_end'
:
mocked_course_overview
.
enrollment_end
,
'key'
:
str
(
mocked_course_overview
.
id
)
,
'enrollment_end'
:
None
,
'pacing_type'
:
'self_paced'
,
'type'
:
'verified'
}
...
...
@@ -481,8 +481,8 @@ class StudentDashboardTests(SharedModuleStoreTestCase, MilestonesTestCaseMixin):
course_enrollment
=
CourseEnrollmentFactory
(
user
=
self
.
user
,
course_id
=
unicode
(
mocked_course_overview
.
id
))
mock_course_runs
.
return_value
=
[
{
'key'
:
mocked_course_overview
.
id
,
'enrollment_end'
:
mocked_course_overview
.
enrollment_end
,
'key'
:
str
(
mocked_course_overview
.
id
)
,
'enrollment_end'
:
str
(
mocked_course_overview
.
enrollment_end
)
,
'pacing_type'
:
'self_paced'
,
'type'
:
'verified'
}
...
...
@@ -517,8 +517,8 @@ class StudentDashboardTests(SharedModuleStoreTestCase, MilestonesTestCaseMixin):
course_enrollment
=
CourseEnrollmentFactory
(
user
=
self
.
user
,
course_id
=
unicode
(
mocked_course_overview
.
id
),
created
=
self
.
THREE_YEARS_AGO
)
mock_course_runs
.
return_value
=
[
{
'key'
:
mocked_course_overview
.
id
,
'enrollment_end'
:
mocked_course_overview
.
enrollment_end
,
'key'
:
str
(
mocked_course_overview
.
id
)
,
'enrollment_end'
:
str
(
mocked_course_overview
.
enrollment_end
)
,
'pacing_type'
:
'self_paced'
,
'type'
:
'verified'
}
...
...
common/djangoapps/student/views.py
View file @
2c984719
...
...
@@ -3,6 +3,7 @@ Student Views
"""
import
datetime
import
dateutil
import
json
import
logging
import
uuid
...
...
@@ -708,7 +709,7 @@ def dashboard(request):
for
course_run
in
course_runs_for_course
:
enrollment_end
=
course_run
.
get
(
'enrollment_end'
)
if
not
enrollment_end
or
enrollment_end
>
datetime
.
datetime
.
now
(
UTC
):
if
not
enrollment_end
or
(
dateutil
.
parser
.
parse
(
enrollment_end
)
>
datetime
.
datetime
.
now
(
UTC
)
):
enrollable_course_runs
.
append
(
course_run
)
course_entitlement_available_sessions
[
str
(
course_entitlement
.
uuid
)]
=
enrollable_course_runs
...
...
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