Skip to content

Commit

Permalink
reuse the enrollable filters
Browse files Browse the repository at this point in the history
  • Loading branch information
annagav committed Aug 22, 2024
1 parent c558d99 commit c2cc7c3
Showing 1 changed file with 3 additions and 7 deletions.
10 changes: 3 additions & 7 deletions courses/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -201,11 +201,7 @@ def get_dated_courseruns(queryset):
- End date can be dated and greater than now or null
- Enrollable (enrollment start is in the past and enrollment end is in the future or null)
"""
now = now_in_utc()
return queryset.filter(
Q(is_self_paced=False)
& Q(start_date__isnull=False)
& (Q(end_date__isnull=True) | Q(end_date__gt=now))
& (Q(enrollment_end__isnull=True) | Q(enrollment_end__gt=now))
& Q(enrollment_start__lt=now)
return queryset.filter(get_enrollable_course_run_filter()
& Q(is_self_paced=False)
& Q(enrollment_end__isnull=False)
)

0 comments on commit c2cc7c3

Please sign in to comment.