Repository: oppia/oppia

Issue:
[Contributor Dashboard] Loading dummy data from admin page should populate translation opportunities
<!--
  - Thanks for taking the time to propose a new feature for the Oppia project.
  - Before filing a new issue, please do a quick search to check that it hasn't
  - already been filed on the [issue tracker](https://github.com/oppia/oppia/issues)._
  -->
Specifically, the 'Load dummy new structures data (only admins)' action in the 'Activities' tab of the admin page:
![2020-06-11](https://user-images.githubusercontent.com/9004726/84455194-89877980-ac11-11ea-871c-af02ad2aea59.png)
This will help our velocity when developing the translate text tab.

[Contributor Dashboard] Loading dummy data from admin page should populate translation opportunities
<!--
  - Thanks for taking the time to propose a new feature for the Oppia project.
  - Before filing a new issue, please do a quick search to check that it hasn't
  - already been filed on the [issue tracker](https://github.com/oppia/oppia/issues)._
  -->
Specifically, the 'Load dummy new structures data (only admins)' action in the 'Activities' tab of the admin page:
![2020-06-11](https://user-images.githubusercontent.com/9004726/84455194-89877980-ac11-11ea-871c-af02ad2aea59.png)
This will help our velocity when developing the translate text tab.



Discussion:

Resolving patch:
diff --git a/core/controllers/admin.py b/core/controllers/admin.py
--- a/core/controllers/admin.py
+++ b/core/controllers/admin.py
@@ -483,6 +483,11 @@ def generate_dummy_story_nodes(node_id, exp_id, title, description):
                 })]
             )
 
+            # Generates translation opportunities for the Contributor Dashboard.
+            exp_ids_in_story = story.story_contents.get_all_linked_exp_ids()
+            opportunity_services.add_new_exploration_opportunities(
+                story_id, exp_ids_in_story)
+
             topic_services.publish_story(topic_id_1, story_id, self.user_id)
         else:
             raise Exception('Cannot load new structures data in production.')


Test patch:
diff --git a/core/controllers/admin_test.py b/core/controllers/admin_test.py
--- a/core/controllers/admin_test.py
+++ b/core/controllers/admin_test.py
@@ -28,6 +28,7 @@
 from core.domain import config_services
 from core.domain import exp_domain
 from core.domain import exp_services
+from core.domain import opportunity_services
 from core.domain import question_fetchers
 from core.domain import recommendations_services
 from core.domain import rights_manager
@@ -276,6 +277,13 @@ def test_load_new_structures_data(self):
                     skill_summaries[2].id], '')
         )
         self.assertEqual(len(questions), 3)
+        # Testing that there are 3 hindi translation opportunities
+        # available on the Contributor Dashboard. Hindi was picked arbitrarily,
+        # any language code other than english (what the dummy explorations
+        # were written in) can be tested here.
+        translation_opportunities, _, _ = (
+            opportunity_services.get_translation_opportunities('hi', None))
+        self.assertEqual(len(translation_opportunities), 3)
         self.logout()
 
     def test_generate_dummy_skill_and_questions_data(self):