From 54d8db512dd24512b87ab3d07376e8ac60acda90 Mon Sep 17 00:00:00 2001 From: John Nagro Date: Thu, 12 Oct 2023 13:47:13 -0400 Subject: [PATCH] fix: only index active programs (#696) --- enterprise_catalog/apps/catalog/algolia_utils.py | 3 ++- enterprise_catalog/apps/catalog/tests/factories.py | 1 + 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/enterprise_catalog/apps/catalog/algolia_utils.py b/enterprise_catalog/apps/catalog/algolia_utils.py index b35958606..a548a5def 100644 --- a/enterprise_catalog/apps/catalog/algolia_utils.py +++ b/enterprise_catalog/apps/catalog/algolia_utils.py @@ -264,7 +264,8 @@ def _should_index_program(program_metadata): return program_json_metadata.get('marketing_url')\ and program_json_metadata.get('type')\ - and not program_json_metadata.get('hidden') + and not program_json_metadata.get('hidden')\ + and program_json_metadata.get('status') == 'active' def partition_program_keys_for_indexing(programs_content_metadata): diff --git a/enterprise_catalog/apps/catalog/tests/factories.py b/enterprise_catalog/apps/catalog/tests/factories.py index 85be5b7d3..44db96b7f 100644 --- a/enterprise_catalog/apps/catalog/tests/factories.py +++ b/enterprise_catalog/apps/catalog/tests/factories.py @@ -135,6 +135,7 @@ def json_metadata(self): 'marketing_url': f'https://marketing.url/{self.content_key}', 'authoring_organizations': authoring_organizations, 'card_image_url': self.card_image_url, + 'status': 'active', }) elif self.content_type == LEARNER_PATHWAY: json_metadata.update({