Skip to content

Commit

Permalink
Merge pull request #833 from openedx/iahmad/ENT-8867
Browse files Browse the repository at this point in the history
fix: Added enterprise uuid to facet search filter for academy tags
  • Loading branch information
irfanuddinahmad authored May 20, 2024
2 parents 343fd5b + 91c0823 commit 718fa10
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
5 changes: 3 additions & 2 deletions enterprise_catalog/apps/api/v1/serializers.py
Original file line number Diff line number Diff line change
Expand Up @@ -398,9 +398,10 @@ def to_representation(self, obj): # pylint: disable=arguments-renamed
tags = super().to_representation(obj)
algolia_client = get_initialized_algolia_client()
academy_uuid = self.context.get('academy_uuid')
if academy_uuid:
enterprise_uuid = self.context.get('enterprise_uuid')
if academy_uuid and enterprise_uuid:
search_query = {
'filters': f'academy_uuids:{academy_uuid}',
'filters': f'academy_uuids:{academy_uuid} AND enterprise_customer_uuids:{enterprise_uuid}',
'maxFacetHits': 50
}
else:
Expand Down
3 changes: 2 additions & 1 deletion enterprise_catalog/apps/api/v1/views/academies.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,8 @@ def request_action(self):
def get_serializer_context(self):
context = super().get_serializer_context()
academy_uuid = str(self.kwargs['uuid']) if 'uuid' in self.kwargs else None
context.update({'academy_uuid': academy_uuid})
enterprise_customer = self.request.GET.get('enterprise_customer', None)
context.update({'academy_uuid': academy_uuid, 'enterprise_uuid': enterprise_customer})
return context

def get_queryset(self):
Expand Down

0 comments on commit 718fa10

Please sign in to comment.