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
fbc896af
Commit
fbc896af
authored
Oct 06, 2014
by
Diana Huang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Sort course and enrollment pairs on dashboard
parent
c4eee8eb
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
4 additions
and
2 deletions
+4
-2
common/djangoapps/student/views.py
+4
-2
No files found.
common/djangoapps/student/views.py
View file @
fbc896af
...
...
@@ -477,6 +477,9 @@ def dashboard(request):
# enrollments, because it could have been a data push snafu.
course_enrollment_pairs
=
list
(
get_course_enrollment_pairs
(
user
,
course_org_filter
,
org_filter_out_set
))
# sort the enrollment pairs by the enrollment date
course_enrollment_pairs
.
sort
(
key
=
lambda
x
:
x
[
1
]
.
created
,
reverse
=
True
)
# Retrieve the course modes for each course
course_modes_by_course
=
{
course
.
id
:
CourseMode
.
modes_for_course_dict
(
course
.
id
)
...
...
@@ -666,10 +669,9 @@ def _get_recently_enrolled_courses(course_enrollment_pairs):
"""
seconds
=
DashboardConfiguration
.
current
()
.
recent_enrollment_time_delta
sorted_list
=
sorted
(
course_enrollment_pairs
,
key
=
lambda
created
:
created
[
1
]
.
created
,
reverse
=
True
)
time_delta
=
(
datetime
.
datetime
.
now
(
UTC
)
-
datetime
.
timedelta
(
seconds
=
seconds
))
return
[
course
for
course
,
enrollment
in
sorted_list
course
for
course
,
enrollment
in
course_enrollment_pairs
# If the enrollment has no created date, we are explicitly excluding the course
# from the list of recent enrollments.
if
enrollment
.
is_active
and
enrollment
.
created
>
time_delta
...
...
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