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

Remove voiceover from exp schema #20675

Closed
wants to merge 40 commits into from
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
40 commits
Select commit Hold shift + click to select a range
f003882
Adds conversions function for exploration migration.
Nik-09 Apr 19, 2024
71a0266
Removes recorded voiceover fields from exploration states backend
Nik-09 Apr 22, 2024
d000747
Merge branch 'develop' of https://github.com/oppia/oppia into remove_…
Nik-09 Jun 8, 2024
68b14ad
Merge branch 'develop' of https://github.com/oppia/oppia into remove_…
Nik-09 Jun 9, 2024
a930682
Fixes merge conflict
Nik-09 Jul 8, 2024
17f95f4
Removed recorded voiceover from exploration
Nik-09 Jul 9, 2024
d9e5a91
Removes feature flag
Nik-09 Jul 9, 2024
2214f8b
Removes voice artist models and UI
Nik-09 Jul 10, 2024
7f21430
Removes audio translation service files and uses.
Nik-09 Jul 14, 2024
d62e948
Fixes merge conflict
Nik-09 Jul 15, 2024
e7a8ac4
Fixes backend tests
Nik-09 Jul 15, 2024
16eacbc
Fixes backend tests
Nik-09 Jul 15, 2024
9fb7eca
Merge branch 'develop' of https://github.com/oppia/oppia into remove_…
Nik-09 Jul 16, 2024
49380f3
Fixes frontend tests
Nik-09 Jul 21, 2024
439c490
Fixes merge conflict and frontend test
Nik-09 Jul 29, 2024
79c333b
Fixes frontend tests
Nik-09 Jul 29, 2024
7de0993
Fixes frontend tests
Nik-09 Aug 1, 2024
a348168
Merge branch 'develop' of https://github.com/oppia/oppia into remove_…
Nik-09 Aug 1, 2024
827700f
Fixes lint issues
Nik-09 Aug 1, 2024
789cb77
Fixes lint issues
Nik-09 Aug 3, 2024
7519f17
Merge branch 'develop' of https://github.com/oppia/oppia into remove_…
Nik-09 Aug 3, 2024
77ce7d1
Fixes merge conflict
Nik-09 Aug 7, 2024
23661e3
Fixes typescript checks
Nik-09 Aug 8, 2024
ff67301
Fixes merge conflict
Nik-09 Aug 18, 2024
4acb589
Merge branch 'develop' of https://github.com/oppia/oppia into remove_…
Nik-09 Sep 4, 2024
8072d16
Merge branch 'develop' of https://github.com/oppia/oppia into remove_…
Nik-09 Sep 21, 2024
3ea710d
Fixes frontend tests
Nik-09 Sep 23, 2024
a06d486
Fixes merge conflicts
Nik-09 Sep 30, 2024
c8a2218
Merge branch 'develop' of https://github.com/oppia/oppia into remove_…
Nik-09 Oct 7, 2024
7f34239
Fixes merge conflict
Nik-09 Oct 30, 2024
11942df
Merge branch 'develop' of https://github.com/oppia/oppia into remove_…
Nik-09 Nov 2, 2024
e89e16c
Fixes frontend tests
Nik-09 Nov 7, 2024
a8ab730
Fixes merge conflict
Nik-09 Nov 11, 2024
fc155ba
Reverts unnecessary changes.
Nik-09 Nov 24, 2024
bd34115
Merge branch 'develop' of https://github.com/oppia/oppia into remove_…
Nik-09 Nov 24, 2024
95d39fa
Merge branch 'develop' of https://github.com/oppia/oppia into remove_…
Nik-09 Dec 1, 2024
c49c609
Fixes backend and lint checks
Nik-09 Dec 1, 2024
a87e250
Fixes merge conflict
Nik-09 Dec 10, 2024
446684c
Merge branch 'develop' into remove_voiceover_from_exp_schema
seanlip Dec 12, 2024
52a7e17
Fixes merge conflict
Nik-09 Jan 9, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Fixes lint issues
  • Loading branch information
Nik-09 committed Aug 3, 2024
commit 789cb7730801541f5b240919a70009c5a2085df4
33 changes: 14 additions & 19 deletions core/controllers/admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -87,23 +87,23 @@

EDUCATION_BLOG_POST_CONTENT = """
<p>
Education is a constantly evolving landscape, and innovation lies at its core.
This summer, Oppia had the privilege of hosting a group of exceptional minds
through the prestigious Google Summer of Code (GSoC) program. These talented
Education is a constantly evolving landscape, and innovation lies at its core.
This summer, Oppia had the privilege of hosting a group of exceptional minds
through the prestigious Google Summer of Code (GSoC) program. These talented
individuals embarked on a journey to transform learning, one code at a time.
</p>\n
<p>
You should check out main
<oppia-noninteractive-link
text-with-value=\"&amp;quot;website.&amp;quot;\"
You should check out main
<oppia-noninteractive-link
text-with-value=\"&amp;quot;website.&amp;quot;\"
url-with-value=\"&amp;quot;https://www.oppia.org&amp;quot;\">
</oppia-noninteractive-link><br>\n&nbsp;
</p>\n\n
<p>Introduction to Oppia - Youtube Video</p>
<oppia-noninteractive-video
autoplay-with-value=\"false\"
end-with-value=\"0\"
start-with-value=\"0\"
<oppia-noninteractive-video
autoplay-with-value=\"false\"
end-with-value=\"0\"
start-with-value=\"0\"
video_id-with-value=\"&amp;quot;Wmvt-HH5-dI&amp;quot;\">
</oppia-noninteractive-video>
"""
Expand Down Expand Up @@ -155,7 +155,7 @@
'category': 'Algorithms',
'author_notes': '',
'blurb': '',
'states_schema_version': 55,
'states_schema_version': 56,
'init_state_name': 'Introduction',
'language_code': 'en',
'objective': 'Learn the exploration',
Expand Down Expand Up @@ -191,11 +191,6 @@
},
'classifier_model_id': None,
'linked_skill_id': None,
'recorded_voiceovers': {
'voiceovers_mapping': {
'content_0': {}
}
},
'solicit_answer_details': False,
'card_is_checkpoint': True,
}
Expand Down Expand Up @@ -431,7 +426,7 @@ def post(self) -> None:
Exception. The num_dummy_exps_to_publish must be provided when
the action is generate_dummy_explorations.
Exception. The num_dummy_translation_opportunities_to_generate
must be provided when the action is
must be provided when the action is
generate_dummy_translation_opportunities.
InvalidInputException. Generate count cannot be less than publish
count.
Expand All @@ -450,7 +445,7 @@ def post(self) -> None:
InvalidInputException. The input provided is not valid.
Exception. The skill_id must be provided when
the action is generate_dummy_question_suggestions.
Exception. The num_dummy_question_suggestions_generate must be
Exception. The num_dummy_question_suggestions_generate must be
provided when the action is generate_dummy_question_suggestions.
"""
assert self.user_id is not None
Expand Down Expand Up @@ -1120,7 +1115,7 @@ def _generate_dummy_translation_opportunities(
'User does not have enough rights to generate data.')
logging.info(
'[ADMIN] %s generated %s number of dummy '
'translation opportunities (explorations)' %
'translation opportunities (explorations)' %
(self.user_id, num_dummy_translation_opportunities_to_generate)
)

Expand Down
3 changes: 1 addition & 2 deletions core/controllers/creator_dashboard.py
Original file line number Diff line number Diff line change
Expand Up @@ -463,8 +463,7 @@ def post(self) -> None:
new_exploration_id = exp_fetchers.get_new_exploration_id()
if constants.ALLOW_YAML_FILE_UPLOAD:
exp_services.save_new_exploration_from_yaml_and_assets(
self.user_id, yaml_content, new_exploration_id, [],
strip_voiceovers=True)
self.user_id, yaml_content, new_exploration_id, [])
self.render_json({
EXPLORATION_ID_KEY: new_exploration_id
})
Expand Down
17 changes: 0 additions & 17 deletions core/controllers/domain_objects_validator_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -383,13 +383,6 @@ def test_valid_object_raises_no_exception(self) -> None:
'hints': []
},
'linked_skill_id': None,
'recorded_voiceovers': {
'voiceovers_mapping': {
'content_0': {},
'default_outcome_1': {},
'ca_placeholder_2': {}
}
},
'classifier_model_id': None,
'card_is_checkpoint': False,
'solicit_answer_details': False
Expand Down Expand Up @@ -485,16 +478,6 @@ def test_valid_object_raises_no_exception(self) -> None:
'solution': None
},
'param_changes': [],
'recorded_voiceovers': {
'voiceovers_mapping': {
'content_0': {},
'default_outcome_1': {},
'ca_choices_2': {},
'ca_choices_3': {},
'feedback_4': {},
'feedback_5': {}
}
},
'solicit_answer_details': False,
'card_is_checkpoint': False
}
Expand Down
10 changes: 1 addition & 9 deletions core/controllers/suggestion_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -1453,7 +1453,7 @@ def test_raises_exception_if_target_exploration_image_is_not_in_target_explorati
self.assertIn(
'An image in the submitted translation\'s original content '
'named "img.png" cannot be found. Please save it to the '
'backend file system at /exploration/%s/assets/image/ '
'backend file system at /exploration/%s/assets/image/ '
'before submitting this translation again.' % exp_id,
response_dict['error']
)
Expand Down Expand Up @@ -2374,14 +2374,6 @@ def test_accept_question_suggestion_with_image_region_interactions(
'id': 'ImageClickInput', 'solution': None
},
'param_changes': [],
'recorded_voiceovers': {
'voiceovers_mapping': {
'content_0': {},
'default_outcome_1': {},
'feedback_2': {},
'hint_3': {}
}
},
'solicit_answer_details': False,
'card_is_checkpoint': False
}
Expand Down
10 changes: 0 additions & 10 deletions core/domain/caching_services_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,16 +59,6 @@ class CachingServicesUnitTests(test_utils.GenericTestBase):
'Introduction': {
'card_is_checkpoint': True,
'solicit_answer_details': False,
'recorded_voiceovers': {
'voiceovers_mapping': {
'hint_5': {},
'feedback_4': {},
'content_0': {},
'ca_placeholder_3': {},
'default_outcome_1': {},
'rule_input_6': {}
}
},
'param_changes': [],
'classifier_model_id': None,
'content': {
Expand Down
16 changes: 0 additions & 16 deletions core/domain/classifier_services_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -128,9 +128,6 @@ def test_creation_of_jobs_and_mappings(self) -> None:
'x']['contentId'] = 'rule_input_4'
new_answer_group.rule_specs[0].inputs[
'x']['normalizedStrSet'] = ['Divide']
state.recorded_voiceovers.voiceovers_mapping['new_feedback'] = {}
state.recorded_voiceovers.voiceovers_mapping[
'rule_input_4'] = {}
state.interaction.answer_groups.insert(3, new_answer_group)
answer_groups: List[state_domain.AnswerGroupDict] = []
for answer_group in state.interaction.answer_groups:
Expand All @@ -140,11 +137,6 @@ def test_creation_of_jobs_and_mappings(self) -> None:
'state_name': 'Home',
'property_name': 'answer_groups',
'new_value': answer_groups
}), exp_domain.ExplorationChange({
'cmd': 'edit_state_property',
'state_name': 'Home',
'property_name': 'recorded_voiceovers',
'new_value': state.recorded_voiceovers.to_dict()
})]
with self.swap(feconf, 'ENABLE_ML_CLASSIFIERS', True):
exp_services.update_exploration(
Expand Down Expand Up @@ -219,9 +211,6 @@ def test_that_models_are_recreated_if_not_available(self) -> None:
'x']['contentId'] = 'rule_input_4'
new_answer_group.rule_specs[0].inputs[
'x']['normalizedStrSet'] = ['Multiplication']
state.recorded_voiceovers.voiceovers_mapping['new_feedback'] = {}
state.recorded_voiceovers.voiceovers_mapping[
'rule_input_4'] = {}
state.interaction.answer_groups.insert(3, new_answer_group)
answer_groups = []
for answer_group in state.interaction.answer_groups:
Expand All @@ -231,11 +220,6 @@ def test_that_models_are_recreated_if_not_available(self) -> None:
'state_name': 'Home',
'property_name': 'answer_groups',
'new_value': answer_groups
}), exp_domain.ExplorationChange({
'cmd': 'edit_state_property',
'state_name': 'Home',
'property_name': 'recorded_voiceovers',
'new_value': state.recorded_voiceovers.to_dict()
})]
with self.swap(feconf, 'ENABLE_ML_CLASSIFIERS', True):
exp_services.update_exploration(
Expand Down
19 changes: 9 additions & 10 deletions core/domain/draft_upgrade_services.py
Original file line number Diff line number Diff line change
Expand Up @@ -1050,15 +1050,12 @@ def _convert_states_v30_dict_to_v31_dict(
for i, change in enumerate(draft_change_list):
if (change.cmd == exp_domain.CMD_EDIT_STATE_PROPERTY and
change.property_name ==
exp_domain.STATE_PROPERTY_RECORDED_VOICEOVERS):
# Here we use cast because this 'if' condition forces change to
# have type EditExpStatePropertyRecordedVoiceoversCmd.
edit_recorded_voiceovers_cmd = cast(
exp_domain.EditExpStatePropertyRecordedVoiceoversCmd,
change
)
exp_domain.DEPRECATED_STATE_PROPERTY_RECORDED_VOICEOVERS):
# Ruling out the possibility of any other type for mypy
# type checking.
assert isinstance(change.new_value, dict)
recorded_voiceovers_dict = (
edit_recorded_voiceovers_cmd.new_value
change.new_value
)
new_voiceovers_mapping = recorded_voiceovers_dict[
'voiceovers_mapping'
Expand All @@ -1072,7 +1069,8 @@ def _convert_states_v30_dict_to_v31_dict(
draft_change_list[i] = exp_domain.ExplorationChange({
'cmd': exp_domain.CMD_EDIT_STATE_PROPERTY,
'property_name': (
exp_domain.STATE_PROPERTY_RECORDED_VOICEOVERS),
exp_domain.DEPRECATED_STATE_PROPERTY_RECORDED_VOICEOVERS
),
'state_name': change.state_name,
'new_value': {
'voiceovers_mapping': new_voiceovers_mapping
Expand Down Expand Up @@ -1174,7 +1172,8 @@ def _convert_states_v27_dict_to_v28_dict(
draft_change_list[i] = exp_domain.ExplorationChange({
'cmd': exp_domain.CMD_EDIT_STATE_PROPERTY,
'property_name': (
exp_domain.STATE_PROPERTY_RECORDED_VOICEOVERS),
exp_domain.DEPRECATED_STATE_PROPERTY_RECORDED_VOICEOVERS
),
'state_name': change.state_name,
'new_value': {
'voiceovers_mapping': voiceovers_dict
Expand Down
3 changes: 2 additions & 1 deletion core/domain/draft_upgrade_services_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -2272,7 +2272,8 @@ def test_convert_states_v27_dict_to_v28_dict(self) -> None:
expected_draft_change_list_v28 = [
exp_domain.ExplorationChange({
'cmd': exp_domain.CMD_EDIT_STATE_PROPERTY,
'property_name': 'recorded_voiceovers',
'property_name': (
exp_domain.DEPRECATED_STATE_PROPERTY_RECORDED_VOICEOVERS),
'state_name': 'State B',
'new_value': {'voiceovers_mapping': {
'content': {
Expand Down
21 changes: 15 additions & 6 deletions core/domain/exp_domain.py
Original file line number Diff line number Diff line change
Expand Up @@ -315,7 +315,8 @@ class ExplorationChange(change_domain.BaseChange):
# Deprecated state properties.
STATE_PROPERTY_CONTENT_IDS_TO_AUDIO_TRANSLATIONS_DEPRECATED,
STATE_PROPERTY_WRITTEN_TRANSLATIONS_DEPRECATED,
STATE_PROPERTY_NEXT_CONTENT_ID_INDEX_DEPRECATED
STATE_PROPERTY_NEXT_CONTENT_ID_INDEX_DEPRECATED,
DEPRECATED_STATE_PROPERTY_RECORDED_VOICEOVERS
]

# The allowed list of exploration properties which can be used in
Expand Down Expand Up @@ -3156,13 +3157,17 @@ def _remove_unwanted_content_ids_from_translations_and_voiceovers_from_state_v51
state_dict['written_translations']['translations_mapping'] = ( # type: ignore[misc]
new_translations_mapping)

# Here we use MyPy ignore because the latest schema of state
# dict doesn't contains recorded_voiceovers property.
voiceovers_mapping = (
state_dict['recorded_voiceovers']['voiceovers_mapping'])
state_dict['recorded_voiceovers']['voiceovers_mapping']) # type: ignore[misc]
new_voiceovers_mapping = {}
for content_id, voiceover_item in voiceovers_mapping.items():
if content_id in content_id_list:
new_voiceovers_mapping[content_id] = voiceover_item
state_dict['recorded_voiceovers']['voiceovers_mapping'] = (
# Here we use MyPy ignore because the latest schema of state
# dict doesn't contains recorded_voiceovers property.
state_dict['recorded_voiceovers']['voiceovers_mapping'] = ( # type: ignore[misc]
new_voiceovers_mapping)

@classmethod
Expand Down Expand Up @@ -3394,7 +3399,9 @@ def _choices_should_be_unique_and_non_empty(
for translation in choice_translations.values():
translation['needs_update'] = True

choice_voiceovers = state_dict['recorded_voiceovers'][
# Here we use MyPy ignore because the latest schema of state
# dict doesn't contains written_translations property.
choice_voiceovers = state_dict['recorded_voiceovers'][ # type: ignore[misc]
'voiceovers_mapping'][content_id]
for choice_voiceover in choice_voiceovers.values():
choice_voiceover['needs_update'] = True
Expand Down Expand Up @@ -3677,7 +3684,9 @@ def _fix_continue_interaction(
for translation in continue_button_translations.values():
translation['needs_update'] = True

choice_voiceovers = state_dict['recorded_voiceovers'][
# Here we use MyPy ignore because the latest schema of state
# dict doesn't contains written_translations property.
choice_voiceovers = state_dict['recorded_voiceovers'][ # type: ignore[misc]
'voiceovers_mapping'][content_id]
for choice_voiceover in choice_voiceovers.values():
choice_voiceover['needs_update'] = True
Expand Down Expand Up @@ -5109,7 +5118,7 @@ def _convert_states_v54_dict_to_v55_dict(
@classmethod
def _convert_states_v55_dict_to_v56_dict(
cls, states_dict: Dict[str, state_domain.StateDict]
) -> Tuple[Dict[str, state_domain.StateDict], int]:
) -> Dict[str, state_domain.StateDict]:
"""Converts from v55 to v56. Version 56 removes and RecordedVoiceovers
from State.
"""
Expand Down
10 changes: 1 addition & 9 deletions core/domain/exp_services.py
Original file line number Diff line number Diff line change
Expand Up @@ -2571,8 +2571,7 @@ def save_new_exploration_from_yaml_and_assets(
committer_id: str,
yaml_content: str,
exploration_id: str,
assets_list: List[Tuple[str, bytes]],
strip_voiceovers: bool = False
assets_list: List[Tuple[str, bytes]]
) -> None:
"""Saves a new exploration given its representation in YAML form and the
list of assets associated with it.
Expand All @@ -2583,8 +2582,6 @@ def save_new_exploration_from_yaml_and_assets(
exploration_id: str. The id of the exploration.
assets_list: list(tuple(str, bytes)). A list of lists of assets, which
contains asset's filename and content.
strip_voiceovers: bool. Whether to strip away all audio voiceovers
from the imported exploration.

Raises:
Exception. The yaml file is invalid due to a missing schema version.
Expand All @@ -2604,11 +2601,6 @@ def save_new_exploration_from_yaml_and_assets(

exploration = exp_domain.Exploration.from_yaml(exploration_id, yaml_content)

# Check whether audio translations should be stripped.
if strip_voiceovers:
for state in exploration.states.values():
state.recorded_voiceovers.strip_all_existing_voiceovers()

create_commit_message = (
'New exploration created from YAML file with title \'%s\'.'
% exploration.title)
Expand Down
Loading