Skip to content

Commit

Permalink
Merge pull request #99 from edly-io/manan/EDLY-7172
Browse files Browse the repository at this point in the history
Added filter option based on date created.
  • Loading branch information
manan-memon authored Dec 4, 2024
2 parents 700d1a5 + a33600c commit fa9a13f
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 2 deletions.
1 change: 1 addition & 0 deletions course_discovery/apps/api/serializers.py
Original file line number Diff line number Diff line change
Expand Up @@ -2320,6 +2320,7 @@ class Meta:
'recent_enrollment_count',
'expected_program_type',
'expected_program_name',
'created'
)


Expand Down
2 changes: 1 addition & 1 deletion course_discovery/apps/api/v1/views/search.py
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ class CourseSearchViewSet(BaseHaystackViewSet):


class CourseRunSearchViewSet(BaseHaystackViewSet):
ordering_fields = ('start', 'id', 'title_override', 'average_rating', 'total_raters')
ordering_fields = ('created', 'start', 'id', 'title_override', 'average_rating', 'total_raters')
filter_backends = [filters.HaystackFilter, OrderingFilter]
index_models = (CourseRun,)
detail_serializer_class = serializers.CourseRunSearchModelSerializer
Expand Down
3 changes: 2 additions & 1 deletion course_discovery/apps/course_metadata/search_indexes.py
Original file line number Diff line number Diff line change
Expand Up @@ -272,7 +272,8 @@ class CourseRunIndex(BaseCourseIndex, indexes.Indexable):
recent_enrollment_count = indexes.IntegerField(model_attr='recent_enrollment_count', null=True)
expected_program_type = indexes.CharField(model_attr='expected_program_type__name', null=True)
expected_program_name = indexes.CharField(model_attr='expected_program_name', null=True)
invite_only = indexes.BooleanField(model_attr='invite_only')
invite_only = indexes.BooleanField(model_attr='invite_only')
created = indexes.DateTimeField(model_attr='created', null=True, faceted=True)

def read_queryset(self, using=None):
# Pre-fetch all fields required by the CourseRunSearchSerializer. Unfortunately, there's
Expand Down

0 comments on commit fa9a13f

Please sign in to comment.