feat: B2C Subscription Inclusion Flag for Program Algolia Reindex#61
Conversation
There was a problem hiding this comment.
Pull request overview
This PR updates the Algolia proxy model layer to rely on the underlying Program.b2c_subscription_inclusion model field (instead of a custom proxy property) and removes the corresponding Algolia-model tests for programs.
Changes:
- Removed the
AlgoliaProxyProgram.b2c_subscription_inclusionproperty override inalgolia_models.py. - Deleted program-focused
b2c_subscription_inclusiontests fromtest_algolia_models.py.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
course_discovery/apps/course_metadata/algolia_models.py |
Removes the program-level b2c_subscription_inclusion override in the Algolia proxy model implementation. |
course_discovery/apps/course_metadata/tests/test_algolia_models.py |
Removes program b2c_subscription_inclusion tests near the end of the Algolia proxy program test suite. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
|
||
|
|
||
| class SearchDefaultResultsConfiguration(models.Model): |
| def b2c_subscription_inclusion(self, value): | ||
| self.__dict__['_b2c_subscription_inclusion'] = value | ||
|
|
||
|
|
| 'translation_languages': [], | ||
| 'transcription_languages': [] | ||
| } |
49634db to
fe933ea
Compare
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
Comments suppressed due to low confidence (1)
course_discovery/apps/course_metadata/tests/test_algolia_models.py:964
- The program-focused b2c_subscription_inclusion tests were removed, leaving no coverage in this module that AlgoliaProxyProgram exposes/persists the flag correctly. Adding at least one focused regression test would help ensure the field continues to be included for program indexing.
def test_program_ai_languages(self):
program = AlgoliaProxyProgramFactory(partner=self.__class__.edxPartner)
assert program.product_ai_languages == {
'translation_languages': [],
'transcription_languages': []
| @property | ||
| def product_external_url(self): | ||
| if hasattr(self, 'degree') and hasattr(self.degree, 'additional_metadata'): | ||
| return self.degree.additional_metadata.external_url | ||
| else: |
fe933ea to
bbc9f8b
Compare
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 2 out of 2 changed files in this pull request and generated no new comments.
Comments suppressed due to low confidence (1)
course_discovery/apps/course_metadata/tests/test_algolia_models.py:965
- The PR removes all AlgoliaProxyProgram tests covering b2c_subscription_inclusion. Since the Algolia reindex uses the proxy model (not the base Program model), it’s useful to keep at least one proxy-level test to guard against regressions where the proxy accidentally shadows or mis-reads the database-backed field (which wouldn’t be caught by course_metadata/tests/test_models.py’s ProgramFactory tests).
def test_program_ai_languages(self):
program = AlgoliaProxyProgramFactory(partner=self.__class__.edxPartner)
assert program.product_ai_languages == {
'translation_languages': [],
'transcription_languages': []
}
No description provided.