-
Notifications
You must be signed in to change notification settings - Fork 4.2k
Handle when no video transcript uploaded for a language #13564
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
Conversation
a2661d2 to
f90705e
Compare
|
@mushtaqak Can you bake sandbox for this change to look at the behavior. |
|
@muzaffaryousaf Sure, I will make one right away :) |
|
I have started the jenkins build which would create the video transcript sandbox |
|
@sstack22 If you try to add a new transcript language and upload no transcript file here in sandbox, you would get the error message and corresponding transcript language is not saved now : The issue is the error message is too generic and does not tell what the error has occurred leading user ambiguity. I have tried to find the correct solution but to implement a good solution would take good amount of time. I have also tried to catch this exception at _save_xblock method which is also called when editor is saved, handling exception here outputs the correct error message : What do you think, we should do here ? |
|
@marcotuts Since @sstack22 is on leave, can you please reply to above question. Thanks :) |
|
@mushtaqak - My suggestion here might be to allow save but to instead reuse the validation message pattern used by the Randomized Content Block (and in this Conditional UI block PR ex: https://github.com/edx/edx-platform/pull/11710) to say something to the effect of: "There is no language transcript file associated with one of the defined transcript languages" (cc'ed @catong here as well). The link / action on this message could read: "Upload transcript file" I included an example of the validation message shown for the conditional block Does this work in terms of reduction in complexity and scope? |
|
If I understand correctly, this error is associated with a specific "Save" of video settings. Perhaps just a slight tweak to @marcotuts' suggestion: |
08ee17f to
1a992fb
Compare
|
@sstack22 Please review from product perspective. You can look at the video component which now shows the validation message if transcript file is not uploaded for a language as suggested by @marcotuts @catong FYI about the validation message containing language name. |
|
@mushtaqak I'm seeing error on this page, can you confirm that's its not happening due to our change ? |
|
@mushtaqak Looks great with the language name brought into the message. Is the language name itself also localized when the message is localized? |
|
@catong Only message is localized, language names are not localized. |
|
Thanks @mushtaqak. Is it preferable to have the specific language name in the message if it will appear only in English regardless of the language of the UI/message or should we have something generic to avoid this? @sstack22 @marcotuts what are your thoughts? |
|
@catong yes, it is infact, I have done that part where we show language name instead of language code. It's just there is some translation issue which I was working on. |
45f8e92 to
ebb789e
Compare
muhammad-ammar
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@mushtaqak I am done with first pass of the review. Let me know once you addressed the feedback.
|
|
||
| def test_save_language_upload_no_transcript(self): | ||
| """ | ||
| Scenario: User can can not save transcript language if no transcript file is uploaded |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
duplicate can
| [u"en", u"English"], | ||
| [u"eo", u"Esperanto"], | ||
| [u"ur", u"Urdu"] | ||
| ) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@mushtaqak We need to restore settings.ALL_LANGUAGES to its original value, otherwise other tests will see this modified value.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@mushtaqak Can we not use @override_settings(ALL_LANGUAGES =()) ?
| """ | ||
| validation = super(VideoDescriptor, self).validate() | ||
| if not isinstance(validation, StudioValidation): | ||
| validation = StudioValidation.copy(validation) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@mushtaqak Why we need to make copy here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it's the way to have validation copy object when we don't have one. Already being used in couple of places.
| And I open tab "Advanced" | ||
| And I add a language "uk" but do not upload an .srt file | ||
| And I save changes | ||
| Then when I view the video |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@mushtaqak I think Then i view the video is enough.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When I view the video captions/language menu
Then I cannot see the language "uk" translation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Then I am not able to see the language "uk" translation
| self.assertIn(unicode_text, self.video.captions_text) | ||
| self.assertEqual(self.video.caption_languages.keys(), ['zh', 'uk']) | ||
|
|
||
| def test_save_language_upload_no_transcript(self): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@mushtaqak This tests check studio side flow. Do we also need a test for lms?
@muzaffaryousaf Any thoughts?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@muhammad-ammar Actually this test checks if a transcript language is shown in language menu if no transcript file is uploaded on video which would be same on LMS side as well.
| self.assertEqual(StudioValidationMessage.WARNING, validation.summary.type) | ||
| self.assertIn("There is no transcript file associated", validation.summary.text) | ||
|
|
||
| def test_no_transcript_multi_lang_validation_message(self): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@mushtaqak I think we can merge test_no_transcript_multi_lang_validation_message and test_no_transcript_single_lang_validation_message into test using ddt. You can see ddt exmamples in test_capa_problem.py
Also please check the complete validation message.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we don't need ddt here, we can just merge both tests.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If we can check both the messages completely without ddt then its good.
| translations = descriptor.available_translations(descriptor.get_transcripts_info(), verify_assets=False) | ||
| self.assertEqual(translations, ['en']) | ||
|
|
||
| def test_video_with_lang_with_no_transcripts_translation(self): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would say to change the name to more readable form, Maybe you can choose test_video_with_language_do_not_have_transcripts_translation.
| # remove key from transcripts because proper srt file does not exist in assets. | ||
| item.transcripts.pop(lang) | ||
| reraised_message += ' ' + ex.message | ||
| pass |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why we don't need this anymore ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Because now we are saving language and not raising exception.
| """ | ||
| # If user transcript filename is empty, raise `TranscriptException` to avoid `InvalidKeyError`. | ||
| if not filename: | ||
| raise TranscriptException("Transcript not uploaded yet") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does raising this exception results into error on studio/lms ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
After @marcotuts 's suggestion to save the language even if the associated transcript file is not uploaded, this does not result into the error on studio/lms.
However, as a precaution, I have added this so that a correct exception would be generated which may/may-not be handled (depends upon the caller of asset_location method). This is just a way for us to be safe from InvalidKeyError when no asset is present.
| sub = self.sub | ||
|
|
||
| # Only attach transcripts that are not empty. | ||
| transcripts = {k: v for k, v in transcripts.items() if v != ''} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can we rename k & v according to the content.
| validation = StudioValidation.copy(validation) | ||
|
|
||
| no_transcript_lang = [] | ||
| for lang, transcript in self.transcripts.items(): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lang --> lang_code
|
|
||
| def test_save_language_upload_no_transcript(self): | ||
| """ | ||
| Scenario: Transcript language is not shown in captions if no transcript file is uploaded |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
captions menu
|
@mushtaqak I've done my first pas and left some comments, let me know when you're done with addressing them. |
c1b9c75 to
2d478a2
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@mushtaqak @muzaffaryousaf There is too much duplication in this test. It can be written far better with ddt.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@mushtaqak I think this will fail. s is missing at the end of language.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would use ddt here for <transcript /> to inject in xml_data_transcripts instead of repeating same thing twice.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Asserts that the validation message has all expected content
|
@mushtaqak i'm done with 2nd pass and left couple of comments. Let me know when you're done. |
09fa876 to
bb82426
Compare
|
@mushtaqak - this looks great 👍 on my end. @catong is the language used here good to go? |
bb82426 to
c03c4d3
Compare
|
👍 |
|
@mushtaqak @sstack22 The error message seems to have changed a bit since I last looked at this PR. Previously we had the word "the" in front of the language name, which reads correctly. Now it looks as if "the" is removed, and it does not read quite grammatically, at least in English. My suggestion is to restore "the", so that the message reads, "There is no transcript associated with the Urdu language." OR remove the word language so that the message reads, "There is no transcript associated with Urdu." |
|
👍 |
|
@catong Thanks for the suggestion. So for surety, the messages would read as follows; When one language missing transcript file :
When multiple languages missing transcript files :
Please correct me if I am wrong. |
|
@mushtaqak That is exactly right. Thanks! |
|
👍 with the message revisions as captured above. Thanks! |
…ge in a video component in studio. Also, don't show respective transcript language in video language menu when a related transcript is not uploaded for that language. TNL-5200
c03c4d3 to
11a07ca
Compare




Description
This change handles the case when no transcript file is uploaded for a language then raise an exception that transcript file is not uploaded yet. This wouldn't let user save transcript language if no transcript file is uploaded for it.
Also, this change handles the videos that have language already added in the database but no transcript file was uploaded. This prevents showing of such languages as transcript on the video.
TNL-5200
Sandbox
Testing
Reviewers
If you've been tagged for review, please check your corresponding box once you've given the 👍.
Post-review