Skip to content
Snippets Groups Projects
Unverified Commit f747493c authored by Harry Rein's avatar Harry Rein Committed by GitHub
Browse files

Merge pull request #17168 from edx/HarryRein/LEARNER-3734-chronological-session-selection

Sort available sessions by start date.
parents 2fab772e 287a00ee
No related branches found
No related tags found
No related merge requests found
......@@ -270,7 +270,7 @@ def get_visible_sessions_for_entitlement(entitlement):
def get_fulfillable_course_runs_for_entitlement(entitlement, course_runs):
"""
Takes a list of course runs and returns only the course runs that:
Takes a list of course runs and returns only the course runs, sorted by start date, that:
1) Are currently running or in the future
2) A user can enroll in
......@@ -311,6 +311,7 @@ def get_fulfillable_course_runs_for_entitlement(entitlement, course_runs):
if is_running and can_upgrade and can_enroll and is_published:
enrollable_sessions.append(course_run)
enrollable_sessions.sort(key=lambda session: session.get('start'))
return enrollable_sessions
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment