Commit d9962e57 by asadiqbal Committed by Douglas Hall

Add Program.is_program_eligible_for_one_click_purchase to discovery service search index

parent 9690b167
......@@ -73,7 +73,7 @@ BASE_PROGRAM_FIELDS = (
PROGRAM_SEARCH_FIELDS = BASE_PROGRAM_FIELDS + (
'aggregation_key', 'authoring_organizations', 'authoring_organization_uuids', 'subject_uuids', 'staff_uuids',
'weeks_to_complete_min', 'weeks_to_complete_max', 'min_hours_effort_per_week', 'max_hours_effort_per_week',
'hidden',
'hidden', 'is_program_eligible_for_one_click_purchase',
)
PROGRAM_FACET_FIELDS = BASE_PROGRAM_FIELDS + ('organizations',)
......
......@@ -1294,6 +1294,7 @@ class TestProgramSearchSerializer:
'max_hours_effort_per_week': program.max_hours_effort_per_week,
'language': [serialize_language(language) for language in program.languages],
'hidden': program.hidden,
'is_program_eligible_for_one_click_purchase': program.is_program_eligible_for_one_click_purchase
}
def test_data(self):
......
......@@ -243,6 +243,9 @@ class ProgramIndex(BaseIndex, indexes.Indexable, OrganizationsMixin):
weeks_to_complete_max = indexes.IntegerField(model_attr='weeks_to_complete_max', null=True)
language = indexes.MultiValueField(faceted=True)
hidden = indexes.BooleanField(model_attr='hidden', faceted=True)
is_program_eligible_for_one_click_purchase = indexes.BooleanField(
model_attr='is_program_eligible_for_one_click_purchase', null=False
)
def prepare_aggregation_key(self, obj):
return 'program:{}'.format(obj.uuid)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment