Skip to content

Commit

Permalink
chore: update course_run_detail method in CourseSearchDocument serial…
Browse files Browse the repository at this point in the history
…izer (#4408)

* chore: update course_run_detail method in CourseSearchDocument serializer

* fix: serializer

* test: update serialier results

* refactor: unwanted code

* test: fixed another test-case

* chore: test fixups
  • Loading branch information
AfaqShuaib09 authored Aug 12, 2024
1 parent ccc48a6 commit b124344
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
6 changes: 4 additions & 2 deletions course_discovery/apps/api/tests/test_serializers.py
Original file line number Diff line number Diff line change
Expand Up @@ -2351,7 +2351,8 @@ def test_detail_fields_in_response(self, is_post_request):
'content_language': course_run.language.code if course_run.language else None,
'restriction_type': (
course_run.restricted_run.restriction_type if hasattr(course_run, 'restricted_run') else None
)
),
'fixed_price_usd': float(course_run.fixed_price_usd),
}],
'uuid': str(course.uuid),
'subjects': [subject.name for subject in course.subjects.all()],
Expand Down Expand Up @@ -2424,7 +2425,8 @@ def get_expected_data(cls, course, course_run, course_skill, seat):
'is_enrollable': course_run.is_enrollable,
'restriction_type': (
course_run.restricted_run.restriction_type if hasattr(course_run, 'restricted_run') else None
)
),
'fixed_price_usd': float(course_run.fixed_price_usd),
}],
'uuid': str(course.uuid),
'subjects': [subject.name for subject in course.subjects.all()],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ def course_run_detail(self, request, detail_fields, course_run):
'restriction_type': (
course_run.restricted_run.restriction_type if hasattr(course_run, 'restricted_run') else None
),
'fixed_price_usd': float(course_run.fixed_price_usd) if course_run.fixed_price_usd else None,
}
if detail_fields:
course_run_detail.update(
Expand Down

0 comments on commit b124344

Please sign in to comment.