internlm/SWE-Fixer-Train-110K huggingface dataset:
Repository: oppia/oppia

Issue:
Languages listed in selection dropdown should be in alphabetical order
This happens in the splash and preferences page. The languages selector dropdown should list languages in alphabetical order to make them easier to find.



Discussion:
I would like to tackle this issue :)


Resolving patch:
diff --git a/core/storage/user/gae_models.py b/core/storage/user/gae_models.py
--- a/core/storage/user/gae_models.py
+++ b/core/storage/user/gae_models.py
@@ -60,7 +60,8 @@ class UserSettingsModel(base_models.BaseModel):
     # System language preference (for I18N).
     preferred_site_language_code = ndb.StringProperty(
         default=None,
-        choices=feconf.SUPPORTED_SITE_LANGUAGES.keys())
+        choices=[language['id'] for language in feconf.SUPPORTED_SITE_LANGUAGES]
+        )
 
     @classmethod
     def is_normalized_username_taken(cls, normalized_username):
diff --git a/feconf.py b/feconf.py
--- a/feconf.py
+++ b/feconf.py
@@ -697,14 +697,27 @@ def get_empty_ratings():
 DEFAULT_TOPIC_SIMILARITY = 0.5
 SAME_TOPIC_SIMILARITY = 1.0
 
-SUPPORTED_SITE_LANGUAGES = {
-    'en': 'English',
-    'es': 'Español',
-    'id': 'Bahasa Indonesia',
-    'pt': 'Português',
-    'vi': 'Tiếng Việt',
-    'hi': 'हिन्दी',
-}
+# NOTE TO DEVELOPERS: While adding another language, please ensure that the
+# languages are in alphabetical order.
+SUPPORTED_SITE_LANGUAGES = [{
+    'id': 'id',
+    'text': 'Bahasa Indonesia'
+}, {
+    'id': 'en',
+    'text': 'English'
+}, {
+    'id': 'es',
+    'text': 'Español'
+}, {
+    'id': 'pt',
+    'text': 'Português'
+}, {
+    'id': 'vi',
+    'text': 'Tiếng Việt'
+}, {
+    'id': 'hi',
+    'text': 'हिन्दी'
+}]
 SYSTEM_USERNAMES = [SYSTEM_COMMITTER_ID, MIGRATION_BOT_USERNAME]
 SYSTEM_USER_IDS = [SYSTEM_COMMITTER_ID, MIGRATION_BOT_USERNAME]
 


Test patch:
diff --git a/core/tests/karma-globals.js b/core/tests/karma-globals.js
--- a/core/tests/karma-globals.js
+++ b/core/tests/karma-globals.js
@@ -20,10 +20,13 @@ var GLOBALS = {
   INTERACTION_SPECS: {},
   GADGET_SPECS: {},
   PANEL_SPECS: {},
-  SUPPORTED_SITE_LANGUAGES: {
-    en: 'English',
-    es: 'Español'
-  }
+  SUPPORTED_SITE_LANGUAGES: [{
+    id: 'id',
+    text: 'Bahasa Indonesia'
+  }, {
+    id: 'en',
+    text: 'English'
+  }]
 };
 
 /* This function overwrites the translationProvider for a dummy function
Repository: oppia/oppia

Issue:
Remove js inlining from objects/templates
This is in continuation with https://github.com/oppia/oppia/pull/2356 .
- [ ] Remove js inlining from objects/templates



Discussion:

Resolving patch:
diff --git a/core/controllers/base.py b/core/controllers/base.py
--- a/core/controllers/base.py
+++ b/core/controllers/base.py
@@ -33,7 +33,6 @@
 from core import counters
 from core.domain import config_domain
 from core.domain import config_services
-from core.domain import obj_services
 from core.domain import rights_manager
 from core.domain import rte_component_registry
 from core.domain import user_services
@@ -317,10 +316,6 @@ def render_template(
             # The 'path' variable starts with a forward slash.
             'FULL_URL': '%s://%s%s' % (scheme, netloc, path),
             'INVALID_NAME_CHARS': feconf.INVALID_NAME_CHARS,
-            # TODO(sll): Consider including the obj_editor html directly as
-            # part of the base HTML template?
-            'OBJECT_EDITORS_JS': jinja2.utils.Markup(
-                obj_services.get_all_object_editor_js_templates()),
             'RTE_COMPONENT_SPECS': (
                 rte_component_registry.Registry.get_all_specs()),
             'SITE_FEEDBACK_FORM_URL': SITE_FEEDBACK_FORM_URL.value,
diff --git a/core/domain/obj_services.py b/core/domain/obj_services.py
--- a/core/domain/obj_services.py
+++ b/core/domain/obj_services.py
@@ -64,18 +64,6 @@ def get_object_class_by_type(cls, obj_type):
         return cls.objects_dict[obj_type]
 
 
-def get_all_object_editor_js_templates():
-    """Returns a string containing the JS templates for all objects."""
-    object_editors_js = ''
-
-    all_object_classes = Registry.get_all_object_classes()
-    for obj_cls in all_object_classes.values():
-        if obj_cls.has_editor_js_template():
-            object_editors_js += obj_cls.get_editor_js_template()
-
-    return object_editors_js
-
-
 def get_default_object_values():
     """Returns a dictionary containing the default object values."""
     # TODO(wxy): Cache this as it is accessed many times.
diff --git a/extensions/objects/models/objects.py b/extensions/objects/models/objects.py
--- a/extensions/objects/models/objects.py
+++ b/extensions/objects/models/objects.py
@@ -20,6 +20,7 @@
 import os
 
 import feconf
+import jinja_utils
 import schema_utils
 import utils
 
@@ -77,9 +78,10 @@ def get_editor_html_template(cls):
             raise Exception(
                 'There is no editor template defined for objects of type %s' %
                 cls.__name__)
-        return utils.get_file_contents(os.path.join(
+        html_templates = utils.get_file_contents(os.path.join(
             os.getcwd(), feconf.OBJECT_TEMPLATES_DIR,
             '%s.html' % cls.edit_html_filename))
+        return jinja_utils.interpolate_cache_slug('%s' % html_templates)
 
 
 class Boolean(BaseObject):


Test patch:
Repository: oppia/oppia

Issue:
The default text which appears while inserting a mathematical formula should be a placeholder.
When introducing a mathematical formula in RTE, it becomes irritating to remove '\frac{x}{y}' every time. This should be converted to a placeholder for convenience. Here is an image for reference.

![image](https://cloud.githubusercontent.com/assets/13691317/18223711/948da740-71dd-11e6-85f8-5027895e5332.png)



Discussion:
Could I work on this?

Hey! @Arunabh98 -- Sure, Assigned you.


Resolving patch:
diff --git a/extensions/rich_text_components/Math/Math.py b/extensions/rich_text_components/Math/Math.py
--- a/extensions/rich_text_components/Math/Math.py
+++ b/extensions/rich_text_components/Math/Math.py
@@ -33,5 +33,5 @@ class Math(base.BaseRichTextComponent):
             'type': 'custom',
             'obj_type': 'MathLatexString',
         },
-        'default_value': '\\frac{x}{y}'
+        'default_value': ''
     }]


Test patch:
Repository: oppia/oppia

Issue:
Update the "collections" section of the creator dashboard to use the newer summary tiles.
In the creator dashboard, the "collections" tab shows long horizontal cards. These are out of sync with the rest of the site, and should instead be replaced with the smaller collection summary tiles that are used in the library page.



Discussion:

Resolving patch:
diff --git a/core/controllers/dashboard.py b/core/controllers/dashboard.py
--- a/core/controllers/dashboard.py
+++ b/core/controllers/dashboard.py
@@ -204,6 +204,7 @@ def _round_average_ratings(rating):
                     'created_on': utils.get_time_in_millisecs(
                         collection_summary.collection_model_created_on),
                     'status': collection_summary.status,
+                    'node_count': collection_summary.node_count,
                     'community_owned': collection_summary.community_owned,
                     'thumbnail_icon_url': (
                         utils.get_thumbnail_icon_url_for_category(


Test patch:
Repository: oppia/oppia

Issue:
Option to return to collection view after an exploration in a collection is finished
At the end of the exploration, there’s usually a set of “suggested next” options. If the user is currently within a collection, the last one of these should be the stacked-cards graphic used to represent the collection in the library view, with “Return to Collection” on the top card.

When clicking 'view output' for a job in the admin panel, the page should auto-scroll to the displayed output
When clicking on 'show output' for a completed job in the jobs tab of the admin panel, the page should automatically scroll to the displayed output.



Discussion:

Resolving patch:
diff --git a/core/controllers/library.py b/core/controllers/library.py
--- a/core/controllers/library.py
+++ b/core/controllers/library.py
@@ -305,3 +305,25 @@ def get(self):
             'summaries': summaries
         })
         self.render_json(self.values)
+
+
+class CollectionSummariesHandler(base.BaseHandler):
+    """Returns collection summaries corresponding to collection ids.
+    """
+
+    GET_HANDLER_ERROR_RETURN_TYPE = feconf.HANDLER_TYPE_JSON
+
+    def get(self):
+        """Handles GET requests."""
+        try:
+            collection_ids = json.loads(
+                self.request.get('stringified_collection_ids'))
+        except Exception:
+            raise self.PageNotFoundException
+        summaries = (
+            summary_services.get_displayable_collection_summary_dicts_matching_ids( # pylint: disable=line-too-long
+                collection_ids))
+        self.values.update({
+            'summaries': summaries
+        })
+        self.render_json(self.values)
diff --git a/feconf.py b/feconf.py
--- a/feconf.py
+++ b/feconf.py
@@ -442,6 +442,7 @@ def get_empty_ratings():
 # TODO(sll): Add all other URLs here.
 ADMIN_URL = '/admin'
 COLLECTION_DATA_URL_PREFIX = '/collection_handler/data'
+COLLECTION_SUMMARIES_DATA_URL = '/collectionsummarieshandler/data'
 EDITABLE_COLLECTION_DATA_URL_PREFIX = '/collection_editor_handler/data'
 COLLECTION_RIGHTS_PREFIX = '/collection_editor_handler/rights'
 COLLECTION_EDITOR_URL_PREFIX = '/collection_editor/create'
diff --git a/main.py b/main.py
--- a/main.py
+++ b/main.py
@@ -217,6 +217,9 @@ def ui_access_wrapper(self, *args, **kwargs):
     get_redirect_route(
         feconf.EXPLORATION_SUMMARIES_DATA_URL,
         library.ExplorationSummariesHandler),
+    get_redirect_route(
+        feconf.COLLECTION_SUMMARIES_DATA_URL,
+        library.CollectionSummariesHandler),
 
     get_redirect_route(r'/profile/<username>', profile.ProfilePage),
     get_redirect_route(


Test patch:
Repository: oppia/oppia

Issue:
Image region interaction: Prevent accidental clearing
Originally part of #2968 . Filing as separate issue.

Prevent accidentally clearing the image and regions when pressing the "Clear Image and Regions" button. Add a confirmation prompt upon clicking the "Clear Image and Regions" button to ensure the user actually intended to press it.


Image region interaction: Prevent accidental clearing
Originally part of #2968 . Filing as separate issue.

Prevent accidentally clearing the image and regions when pressing the "Clear Image and Regions" button. Add a confirmation prompt upon clicking the "Clear Image and Regions" button to ensure the user actually intended to press it.




Discussion:
I would like to take this , also I have signed the CLA and taken the contributor survey.
Welcome! Sounds good, please go ahead.
@itaditya -- did you manage to get things set up locally? If not, let's release this issue so that someone else can take it.

Thanks!
Hi @itaditya, would you still like to take up the issue? Please assign it to yourself in case you would.
#3110 @seanlip I have made a pull request. please review it.
Note: current PR is in #3116.
Note to contributors: Please note prior work in #3116 -- new PRs can build off of that. (Thanks @srikar0896!) 
Hi @srikar0896! Would you like to take this up again?
Hi Sean, I can take this one.
I would like to take this , also I have signed the CLA and taken the contributor survey.
Welcome! Sounds good, please go ahead.
@itaditya -- did you manage to get things set up locally? If not, let's release this issue so that someone else can take it.

Thanks!
Hi @itaditya, would you still like to take up the issue? Please assign it to yourself in case you would.
#3110 @seanlip I have made a pull request. please review it.
Note: current PR is in #3116.
Note to contributors: Please note prior work in #3116 -- new PRs can build off of that. (Thanks @srikar0896!) 
Hi @srikar0896! Would you like to take this up again?
Hi Sean, I can take this one.

Resolving patch:
diff --git a/scripts/pre_commit_linter.py b/scripts/pre_commit_linter.py
--- a/scripts/pre_commit_linter.py
+++ b/scripts/pre_commit_linter.py
@@ -36,7 +36,7 @@
 CUSTOMIZATION OPTIONS
 =====================
 1.  To lint only files that have been touched in this commit
-       python scripts/pre_commit_linter.py
+        python scripts/pre_commit_linter.py
 
 2.  To lint all files in the folder or to lint just a specific file
         python scripts/pre_commit_linter.py --path filepath


Test patch:
Repository: oppia/oppia

Issue:
Add new config property on admin page to add vmid and shared secret key
We are currently desigining to use a separate VM for training classifiers. To make communication between VM and Oppia secure we are planning to use a shared secret key. Therefore we need some convinient way to add this secret key in Oppia.

TODO: Modify "/admin" page to have a new config property which will be used to add two fields 1. VMID and 2. Shared secret key. Add relevant config_property in backend. Also ensure that there is a VMID and a shared key in config_property by default.


Discussion:

Resolving patch:
diff --git a/core/domain/config_domain.py b/core/domain/config_domain.py
--- a/core/domain/config_domain.py
+++ b/core/domain/config_domain.py
@@ -18,6 +18,8 @@
 
 from core.domain import user_services
 from core.platform import models
+
+import feconf
 import schema_utils
 
 (config_models,) = models.Registry.import_models([models.NAMES.config])
@@ -35,6 +37,24 @@
     }],
 }
 
+VMID_SHARED_SECRET_KEY_SCHEMA = {
+    'type': 'list',
+    'items': {
+        'type': 'dict',
+        'properties': [{
+            'name': 'vm_id',
+            'schema': {
+                'type': 'unicode'
+            }
+        }, {
+            'name': 'shared_secret_key',
+            'schema': {
+                'type': 'unicode'
+            }
+        }]
+    }
+}
+
 BOOL_SCHEMA = {
     'type': schema_utils.SCHEMA_TYPE_BOOL
 }
@@ -257,3 +277,11 @@ def update_moderator_ids(committer_id, moderator_usernames):
 PROMO_BAR_MESSAGE = ConfigProperty(
     'promo_bar_message', UNICODE_SCHEMA,
     'The message to show to all users if the promo bar is enabled', '')
+
+VMID_SHARED_SECRET_KEY_MAPPING = ConfigProperty(
+    'vmid_shared_secret_key_mapping', VMID_SHARED_SECRET_KEY_SCHEMA,
+    'VMID and shared secret key corresponding to that VM',
+    [{
+        'vm_id': feconf.DEFAULT_VM_ID,
+        'shared_secret_key': feconf.DEFAULT_VM_SHARED_SECRET
+    }])
diff --git a/feconf.py b/feconf.py
--- a/feconf.py
+++ b/feconf.py
@@ -155,6 +155,11 @@
 # Default objective for a newly-minted collection.
 DEFAULT_COLLECTION_OBJECTIVE = ''
 
+# Default ID of VM which is used for training classifier.
+DEFAULT_VM_ID = 'vm_default'
+# Shared secret key for default VM.
+DEFAULT_VM_SHARED_SECRET = '1a2b3c4e'
+
 # A dict containing the accepted image formats (as determined by the imghdr
 # module) and the corresponding allowed extensions in the filenames of uploaded
 # files.


Test patch:
Repository: oppia/oppia

Issue:
Failing FallbackOneOffJob for fallback outcomes with no feedback entries in production
Some fallback outcomes in production have no feedback entries and this case needs to be handled safely. Also, this job must be restricted to public explorations.



Discussion:

Resolving patch:
diff --git a/core/domain/exp_jobs_one_off.py b/core/domain/exp_jobs_one_off.py
--- a/core/domain/exp_jobs_one_off.py
+++ b/core/domain/exp_jobs_one_off.py
@@ -343,17 +343,22 @@ def map(item):
             return
 
         exploration = exp_services.get_exploration_from_model(item)
-        for state_name, state in exploration.states.iteritems():
-            for fallback in state.interaction.fallbacks:
-                num_submits = fallback.trigger.customization_args['num_submits']
-                feedback = fallback.outcome.feedback[0]
-                yield (
-                    '%s: %s' % (
-                        item.id,
-                        state_name.encode('utf-8')),
-                    '%s: %s' % (
-                        num_submits['value'],
-                        feedback.encode('utf-8')))
+        exp_rights = rights_manager.get_exploration_rights(item.id)
+        if exp_rights.status == rights_manager.ACTIVITY_STATUS_PUBLIC:
+            for state_name, state in exploration.states.iteritems():
+                for fallback in state.interaction.fallbacks:
+                    num_submits = (
+                        fallback.trigger.customization_args['num_submits'])
+                    feedback = (
+                        fallback.outcome.feedback[0]
+                        if len(fallback.outcome.feedback) > 0 else 'ERROR')
+                    yield (
+                        '%s: %s' % (
+                            item.id,
+                            state_name.encode('utf-8')),
+                        '%s: %s' % (
+                            num_submits['value'],
+                            feedback.encode('utf-8')))
 
     @staticmethod
     def reduce(key, values):


Test patch:
Repository: oppia/oppia

Issue:
Migrate fallbacks to hints 
Current fallbacks in production need to be migrated to hints. Also, when a new fallback is created it must be copied as a hint.


Discussion:

Resolving patch:
diff --git a/core/domain/exp_domain.py b/core/domain/exp_domain.py
--- a/core/domain/exp_domain.py
+++ b/core/domain/exp_domain.py
@@ -873,9 +873,7 @@ def validate(self, exp_param_specs_dict):
             if self.solution:
                 Solution.from_dict(
                     self.id, self.solution).validate(self.id)
-            else:
-                raise utils.ValidationError(
-                    'Solution must be specified if hint(s) are specified')
+
         elif self.solution:
             raise utils.ValidationError(
                 'Hint(s) must be specified if solution is specified')
@@ -1396,6 +1394,17 @@ def update_interaction_fallbacks(self, fallbacks_list):
         self.interaction.fallbacks = [
             Fallback.from_dict(fallback_dict)
             for fallback_dict in fallbacks_list]
+        if self.interaction.fallbacks:
+            hint_list = []
+            for fallback in self.interaction.fallbacks:
+                if fallback.outcome.feedback:
+                    # If a fallback outcome has a non-empty feedback list
+                    # the feedback is converted to a Hint. It may contain
+                    # only one list item.
+                    hint_list.append(
+                        Hint(fallback.outcome.feedback[0]).to_dict())
+        self.update_interaction_hints(hint_list)
+
 
     def update_interaction_hints(self, hints_list):
         if not isinstance(hints_list, list):
@@ -2434,6 +2443,10 @@ def _convert_states_v9_dict_to_v10_dict(cls, states_dict):
             interaction = state_dict['interaction']
             if 'hints' not in interaction:
                 interaction['hints'] = []
+                for fallback in interaction['fallbacks']:
+                    if fallback['outcome']['feedback']:
+                        interaction['hints'].append(
+                            Hint(fallback['outcome']['feedback'][0]).to_dict())
             if 'solution' not in interaction:
                 interaction['solution'] = {}
         return states_dict


Test patch:
diff --git a/core/domain/exp_domain_test.py b/core/domain/exp_domain_test.py
--- a/core/domain/exp_domain_test.py
+++ b/core/domain/exp_domain_test.py
@@ -686,9 +686,7 @@ def test_hints_validation(self):
         init_state.update_interaction_hints([{
             'hint_text': 'hint one',
         }])
-        self._assert_validation_error(
-            exploration,
-            r'Solution must be specified if hint\(s\) are specified')
+
         solution = {
             'answer_is_exclusive': False,
             'correct_answer': 'helloworld!',
Repository: oppia/oppia

Issue:
Dummy explorations are published but not indexed in library page.
Looks like the removed code in the 

**commit edf06a80f8f221cb681fb43489ab637bfb9b000b @shaz13 committed 2 days ago**

at line 246 in admin.py was needed to populate published dummy explorations on library page. 


Adding this code back resolves the issue 

```
dummy_exp_list = []
            for i in range(num_dummy_exps_to_generate):
                title = random.choice(possible_titles)
                category = random.choice(feconf.SEARCH_DROPDOWN_CATEGORIES)
                new_exploration_id = exp_services.get_new_exploration_id()
                exploration = exp_domain.Exploration.create_default_exploration(
                    new_exploration_id, title=title, category=category,
                    objective='Dummy Objective')
                exp_services.save_new_exploration(self.user_id, exploration)
                dummy_exp_list.append(new_exploration_id)
                if i <= num_dummy_exps_to_publish - 1:
                    rights_manager.publish_exploration(
                        self.user_id, new_exploration_id)
            exp_services.index_explorations_given_ids(dummy_exp_list)
        else:
            raise Exception('Cannot generate dummy explorations in production.')
```


Discussion:
@seanlip Could you please verify it? 

Resolving patch:
diff --git a/core/controllers/admin.py b/core/controllers/admin.py
--- a/core/controllers/admin.py
+++ b/core/controllers/admin.py
@@ -324,6 +324,7 @@ def _generate_dummy_explorations(
                                'Wonder Anatomy',
                                'Elvish, language of "Lord of the Rings',
                                'The Science of Superheroes']
+            exploration_ids_to_publish = []
             for i in range(num_dummy_exps_to_generate):
                 title = random.choice(possible_titles)
                 category = random.choice(feconf.SEARCH_DROPDOWN_CATEGORIES)
@@ -333,8 +334,11 @@ def _generate_dummy_explorations(
                     objective='Dummy Objective')
                 exp_services.save_new_exploration(self.user_id, exploration)
                 if i <= num_dummy_exps_to_publish - 1:
+                    exploration_ids_to_publish.append(new_exploration_id)
                     rights_manager.publish_exploration(
                         self.user_id, new_exploration_id)
+            exp_services.index_explorations_given_ids(
+                exploration_ids_to_publish)
         else:
             raise Exception('Cannot generate dummy explorations in production.')
 


Test patch: