Skip to content

Commit

Permalink
Merge pull request openedx#668 from proversity-org/proversity/staging
Browse files Browse the repository at this point in the history
Proversity/staging
  • Loading branch information
Nico van Niekerk authored Mar 1, 2018
2 parents fa43413 + f859872 commit d4919bd
Showing 1 changed file with 31 additions and 0 deletions.
31 changes: 31 additions & 0 deletions common/djangoapps/student/views/dashboard.py
Original file line number Diff line number Diff line change
Expand Up @@ -707,6 +707,37 @@ def student_dashboard(request):
enr for enr in course_enrollments if entitlement.enrollment_course_run.course_id != enr.course_id
]


USER_COURSE_ENROLLMENTS_ORDER_BY = configuration_helpers.get_value(
'USER_COURSE_ENROLLMENTS_ORDER_BY',
settings.USER_COURSE_ENROLLMENTS_ORDER_BY
)
# sort the enrollment pairs by the flag USER_COURSE_ENROLLMENTS_ORDER_BY
if USER_COURSE_ENROLLMENTS_ORDER_BY == 'created':
course_enrollments.sort(key=lambda x: x.created, reverse=False)
elif USER_COURSE_ENROLLMENTS_ORDER_BY == 'created_reverse':
course_enrollments.sort(key=lambda x: x.created, reverse=True)
elif USER_COURSE_ENROLLMENTS_ORDER_BY == 'course_name':
course_enrollments.sort(
key=lambda x: x.course.display_name,
reverse=False
)
elif USER_COURSE_ENROLLMENTS_ORDER_BY == 'course_name_reverse':
course_enrollments.sort(
key=lambda x: x.course.display_name,
reverse=True
)


if configuration_helpers.get_value("ENABLE_FILTER_COURSES_BY_USER_LANG",
settings.FEATURES.get('ENABLE_FILTER_COURSES_BY_USER_LANG')):
user_prefered_lang = request.LANGUAGE_CODE
for enrollment in course_enrollments[:]:
course_language = modulestore().get_course(enrollment.course_id).language
if course_language != user_prefered_lang:
course_enrollments.remove(enrollment)


context = {
'urls': urls,
'programs_data': programs_data,
Expand Down

0 comments on commit d4919bd

Please sign in to comment.