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

add: util method in edx-val for listing transcript_languages for a course #565

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

AfaqShuaib09
Copy link
Contributor

@AfaqShuaib09 AfaqShuaib09 commented Feb 17, 2025

PROD-4305

This PR adds the utils method in edx-val for listing transcript_languages for a course.

@AfaqShuaib09 AfaqShuaib09 marked this pull request as draft February 17, 2025 09:14
Copy link

codecov bot commented Feb 17, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 94.60%. Comparing base (b7c5db6) to head (0855bc0).

Additional details and impacted files
@@            Coverage Diff             @@
##           master     #565      +/-   ##
==========================================
+ Coverage   94.58%   94.60%   +0.02%     
==========================================
  Files          32       32              
  Lines        3178     3191      +13     
  Branches      122      122              
==========================================
+ Hits         3006     3019      +13     
  Misses        154      154              
  Partials       18       18              
Flag Coverage Δ
unittests 94.60% <100.00%> (+0.02%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@AfaqShuaib09 AfaqShuaib09 force-pushed the afaq/prod-4305 branch 2 times, most recently from a6e2530 to 5cd9966 Compare February 17, 2025 15:26
@@ -733,6 +733,30 @@ def get_videos_for_course(course_id, sort_field=None, sort_dir=SortDirection.asc
)


@cachetools.func.ttl_cache(maxsize=None, ttl=settings.TTL_CACHE_TIMEOUT)
def get_transcript_languages(course_id, provider_type):
"""
Copy link
Contributor

Choose a reason for hiding this comment

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

This method returns a language even if only one of the available course videos has a transcript in that language. Is this expected behavior?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

yup, it's expected. Output will be union of all transcript_languages with provider_type=edx_ai_translations

@AfaqShuaib09 AfaqShuaib09 marked this pull request as ready for review February 17, 2025 18:02
edxval/api.py Outdated
Returns:
(list): A list of language codes
"""
course_video_ids = CourseVideo.objects.filter(course_id=course_id).values_list('video__id')
Copy link
Contributor

Choose a reason for hiding this comment

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

Only the active/non-hidden videos should be used, in my opinion.

@@ -18,6 +17,7 @@
from lxml.etree import Element, SubElement
from pysrt.srtexc import Error

import cachetools.func
Copy link
Contributor

Choose a reason for hiding this comment

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

this import should be in 2nd level as this is a 3rd party package. Not sure why quality did not fail on this. You can try isort to fix this.

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've already used isort on this file

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.

4 participants