Skip to content

Commit

Permalink
Merge branch 'ENT-9748/introduce-new-marketable-field' of github.com:…
Browse files Browse the repository at this point in the history
…openedx/course-discovery into ENT-9748/introduce-new-marketable-field
  • Loading branch information
hamzawaleed01 committed Dec 5, 2024
2 parents 3407001 + e989579 commit 2277e78
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 10 deletions.
2 changes: 1 addition & 1 deletion course_discovery/apps/api/serializers.py
Original file line number Diff line number Diff line change
Expand Up @@ -961,7 +961,7 @@ def prefetch_queryset(cls, queryset=None):
# queryset passed in happens to be empty.
queryset = queryset if queryset is not None else CourseRun.objects.all()

return queryset.select_related('course', 'type').prefetch_related(
return queryset.select_related('course', 'type', 'course__type').prefetch_related(
'_official_version',
'course__partner',
'restricted_run',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1269,7 +1269,7 @@ def test_list_query(self):
query = 'title:Some random title'
url = '{root}?q={query}'.format(root=reverse('api:v1:course_run-list'), query=query)

with self.assertNumQueries(25, threshold=3):
with self.assertNumQueries(26, threshold=3):
response = self.client.get(url)

actual_sorted = sorted(response.data['results'], key=lambda course_run: course_run['key'])
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -217,7 +217,7 @@ def test_list(self):
""" Verify the endpoint returns a list of all programs. """
expected = [self.create_program() for __ in range(3)]

self.assert_list_results(self.list_path, expected, 26)
self.assert_list_results(self.list_path, expected, 27)

@pytest.mark.parametrize("include_restriction_param", [True, False])
def test_list_restricted_runs(self, include_restriction_param):
Expand Down Expand Up @@ -393,13 +393,13 @@ def test_filter_by_marketing_slug(self):
program.marketing_slug = SLUG
program.save()

self.assert_list_results(url, [program], 24)
self.assert_list_results(url, [program], 25)

def test_list_exclude_utm(self):
""" Verify the endpoint returns marketing URLs without UTM parameters. """
url = self.list_path + '?exclude_utm=1'
program = self.create_program()
self.assert_list_results(url, [program], 23, extra_context={'exclude_utm': 1})
self.assert_list_results(url, [program], 24, extra_context={'exclude_utm': 1})

def test_minimal_serializer_use(self):
""" Verify that the list view uses the minimal serializer. """
Expand Down
4 changes: 2 additions & 2 deletions course_discovery/apps/api/v1/tests/test_views/test_search.py
Original file line number Diff line number Diff line change
Expand Up @@ -207,10 +207,10 @@ def test_availability_faceting(self):
['results', 0, 'program_types', 0], ProgramStatus.Unpublished, 5),
(detailed_path,
CourseRunSearchModelSerializer,
['results', 0, 'programs', 0, 'type'], ProgramStatus.Deleted, 21),
['results', 0, 'programs', 0, 'type'], ProgramStatus.Deleted, 22),
(detailed_path,
CourseRunSearchModelSerializer,
['results', 0, 'programs', 0, 'type'], ProgramStatus.Unpublished, 22),
['results', 0, 'programs', 0, 'type'], ProgramStatus.Unpublished, 23),
)
@ddt.unpack
def test_exclude_unavailable_program_types(self, path, serializer, result_location_keys, program_status,
Expand Down
6 changes: 3 additions & 3 deletions course_discovery/apps/course_metadata/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -2972,11 +2972,11 @@ def is_marketable(self):
@property
def is_marketable_external(self):
"""
Determines if the course_run is suitable for marketing.
Determines if the course_run is suitable for external marketing.
If already marketable, simply return self.is_marketable.
Else, a course run is deemed suitable for marketing if it is an
Else, a course run is deemed suitable for external marketing if it is an
executive education (EE) course, the discovery service status is
'Reviewed', and the course start date is in the future.
Expand Down

0 comments on commit 2277e78

Please sign in to comment.