Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: code changes for ai_languages field #4586

Open
wants to merge 6 commits into
base: anawaz/prod-4306-1
Choose a base branch
from

Conversation

zawan-ila
Copy link
Contributor

@zawan-ila zawan-ila commented Feb 25, 2025

PROD-4306

This is a continuation of 4585

This PR adds the relevant code changes for shifting from the translation_languages field to the ai_languages field. Since we do not care about preserving/copying existing data in the translation_languages field, I have chosen to direct all reads/writes only to the new field ai_languages

@zawan-ila zawan-ila changed the title Management Command Changes Code Changes for ai_languages field Feb 25, 2025
@zawan-ila zawan-ila changed the title Code Changes for ai_languages field feat: code changes for ai_languages field Feb 25, 2025
@@ -1262,3 +1263,42 @@ def get_course_run_statuses(statuses, course_runs):
else:
statuses.add(course_run.status)
return statuses

AI_LANG_SCHEMA = {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not too sure about this change. I like it, as it ensures that we don't put any ugly stuff accidentally in our field. I am a little concerned about having the validation on every save though.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe we should only do the validation in the command, and not on every save?

@@ -3531,6 +3532,8 @@ def clean(self):
self.enrollment_count = 0
if self.recent_enrollment_count is None:
self.recent_enrollment_count = 0
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I can't comment on unchanged code. Can I safely remove the translation_languages field from the model here (but not commit the migration)? I think yes, but would love to know if I am wrong.

# Remove any keys other than `code` and `label`
available_translation_languages = [{'code': lang['code'], 'label': lang['label']} for lang in available_translation_languages]

# Add the labels for the codes. Currently we set the code as the label. We will be fixing this in a follow-up PR
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Right now I am setting the code as the label for transcription_languages. We definitely need to improve this. I intend to leave it as is for now, and handle this in another ticket

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant