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

Issue:
Subscriptions sort in learners dashboard doesn't work correctly.
It can be seen here that the sorting is done by the following keys
https://github.com/oppia/oppia/blob/103a87975a5ce07ae92fdc75441c0b269f7e3dc0/core/templates/pages/learner-dashboard-page/learner-dashboard-page.constants.ts#L48-L57

But the backend returns the following keys

https://github.com/oppia/oppia/blob/103a87975a5ce07ae92fdc75441c0b269f7e3dc0/core/controllers/learner_dashboard.py#L103-L110

Note - I'll be fixing this in my next PR.


Discussion:

Resolving patch:
diff --git a/core/controllers/creator_dashboard.py b/core/controllers/creator_dashboard.py
--- a/core/controllers/creator_dashboard.py
+++ b/core/controllers/creator_dashboard.py
@@ -209,7 +209,7 @@ def _round_average_ratings(rating):
                     'category': collection_summary.category,
                     'objective': collection_summary.objective,
                     'language_code': collection_summary.language_code,
-                    'last_updated': utils.get_time_in_millisecs(
+                    'last_updated_msec': utils.get_time_in_millisecs(
                         collection_summary.collection_model_last_updated),
                     'created_on': utils.get_time_in_millisecs(
                         collection_summary.collection_model_created_on),


Test patch:
diff --git a/core/tests/protractor_desktop/learnerDashboard.js b/core/tests/protractor_desktop/learnerDashboard.js
--- a/core/tests/protractor_desktop/learnerDashboard.js
+++ b/core/tests/protractor_desktop/learnerDashboard.js
@@ -97,12 +97,12 @@ describe('Learner dashboard functionality', function() {
     // dashboard.
     await learnerDashboardPage.get();
     await learnerDashboardPage.navigateToSubscriptionsSection();
-    // The last user (collectionAdm) that learner subsribes to is placed first
+    // The last user (creatorName) that learner subsribes to is placed first
     // in the list.
-    await learnerDashboardPage.expectSubscriptionFirstNameToMatch('collect...');
-    // The first user (creatorName) that learner subscribes to is placed
+    await learnerDashboardPage.expectSubscriptionFirstNameToMatch('creator...');
+    // The first user (collectionAdm) that learner subscribes to is placed
     // last in the list.
-    await learnerDashboardPage.expectSubscriptionLastNameToMatch('creator...');
+    await learnerDashboardPage.expectSubscriptionLastNameToMatch('collect...');
     await users.logout();
   });
Repository: oppia/oppia

Issue:
"Error communicating with server" encountered while creating/accessing/editing any Topic from Topics Tab 
**Describe the bug**
"Error communicating with server" encountered while creating/accessing/editing any Topic from Topics Tab 

**To Reproduce**
Steps to reproduce the behavior:
 1. Go to test server and Login as admin
 2. Click on Topics and skills dashboard
 3. Create a topic by entering name,description and image or 
 4.Click on already existing Topic or
5. Click on three dots and select option edit

**Observed behavior**
"Error communicating with server" encountered while creating/accessing/editing

**Expected behavior**
No error should be shown and Topic should load successfully to view or edit

**Screenshots**
If applicable, add screenshots to help explain your problem.
![image](https://user-images.githubusercontent.com/56336353/86609293-67430a80-bfc9-11ea-845c-101324323407.png)
![image](https://user-images.githubusercontent.com/56336353/86769824-62d02d80-c06d-11ea-830a-651a53ff5752.png)



**Desktop (please complete the following information; delete this section if the issue does not arise on desktop):**
 OS: ChromeOS
Browser Chrome
Version 83.0.4103.119 (Official Build) (64-bit)



Discussion:

Resolving patch:
diff --git a/scripts/build.py b/scripts/build.py
--- a/scripts/build.py
+++ b/scripts/build.py
@@ -124,7 +124,8 @@
 # Hashes for files with these paths should be provided to the frontend in
 # JS hashes object.
 FILEPATHS_PROVIDED_TO_FRONTEND = (
-    'images/*', 'videos/*', 'i18n/*', '*_directive.html', '*.directive.html',
+    'images/*', 'videos/*', 'i18n/*', '*.component.html',
+    '*_directive.html', '*.directive.html',
     '*.template.html', '*.png', '*.json', '*.webp')
 
 HASH_BLOCK_SIZE = 2**20


Test patch:
Repository: oppia/oppia

Issue:
Get rid of unnecessary optional properties
There are a lot of `?` in the types that are not required. They should be removed.
Get rid of unnecessary optional properties
There are a lot of `?` in the types that are not required. They should be removed.


Discussion:

Resolving patch:
diff --git a/core/controllers/creator_dashboard.py b/core/controllers/creator_dashboard.py
--- a/core/controllers/creator_dashboard.py
+++ b/core/controllers/creator_dashboard.py
@@ -324,6 +324,11 @@ def _round_average_ratings(rating):
             self.values.update({
                 'topic_summary_dicts': topic_summary_dicts
             })
+        else:
+            self.values.update({
+                'topic_summary_dicts': []
+            })
+
         self.render_json(self.values)
 
     @acl_decorators.can_access_creator_dashboard


Test patch:
diff --git a/core/controllers/creator_dashboard_test.py b/core/controllers/creator_dashboard_test.py
--- a/core/controllers/creator_dashboard_test.py
+++ b/core/controllers/creator_dashboard_test.py
@@ -776,7 +776,7 @@ def test_get_no_topic_summary_dicts_with_new_structure_players_disabled(
         self.login(self.OWNER_EMAIL)
         with self.swap(constants, 'ENABLE_NEW_STRUCTURE_PLAYERS', False):
             response = self.get_json(feconf.CREATOR_DASHBOARD_DATA_URL)
-            self.assertIsNone(response.get('topic_summary_dicts'))
+            self.assertEqual(response.get('topic_summary_dicts'), [])
         self.logout()
 
     def test_can_update_display_preference(self):
Repository: oppia/oppia

Issue:
Investigate and fix window resize problem in unit tests (editor-navigator)
<!--
  - Thanks for taking the time to report a bug in 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)._
  -->

**Describe the bug**
While writing unit tests for #10073, a weird bug appeared in editor-navigation component unit test. For some reason, it was not possible to test properly the resize observable whenever the screen is large or not, because resize event was not being triggered correctly.

This issue is to investigate why this problem is happening and fix it.

Investigate and fix window resize problem in unit tests (editor-navigator)
<!--
  - Thanks for taking the time to report a bug in 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)._
  -->

**Describe the bug**
While writing unit tests for #10073, a weird bug appeared in editor-navigation component unit test. For some reason, it was not possible to test properly the resize observable whenever the screen is large or not, because resize event was not being triggered correctly.

This issue is to investigate why this problem is happening and fix it.



Discussion:

Resolving patch:
diff --git a/scripts/check_frontend_coverage.py b/scripts/check_frontend_coverage.py
--- a/scripts/check_frontend_coverage.py
+++ b/scripts/check_frontend_coverage.py
@@ -106,7 +106,6 @@
     'drag-and-drop-positive-int-editor.directive.ts',
     'editable-collection-backend-api.service.ts',
     'editable-story-backend-api.service.ts',
-    'editor-navigation.component.ts',
     'email-dashboard-data.service.ts',
     'entity-creation.service.ts',
     'exploration-creation.service.ts',


Test patch:
Repository: oppia/oppia

Issue:
Invalid type check for types in .d.ts files
There is no error in the `.d.ts` files when we assign a type that doesn't exist. We should manually add an automated check for that.
Invalid type check for types in .d.ts files
There is no error in the `.d.ts` files when we assign a type that doesn't exist. We should manually add an automated check for that.


Discussion:

Resolving patch:
diff --git a/scripts/typescript_checks.py b/scripts/typescript_checks.py
--- a/scripts/typescript_checks.py
+++ b/scripts/typescript_checks.py
@@ -77,7 +77,8 @@ def compile_and_check_typescript(config_path):
     process = subprocess.Popen(cmd, stdout=subprocess.PIPE)
     error_messages = []
     for line in iter(process.stdout.readline, ''):
-        error_messages.append(line)
+        if not line.startswith('node_modules'):
+            error_messages.append(line)
     if os.path.exists(COMPILED_JS_DIR):
         shutil.rmtree(COMPILED_JS_DIR)
     if error_messages:


Test patch:
Repository: oppia/oppia

Issue:
Error 111 connecting to localhost:XXXX. (In prod mode on local machines)
<!--
  - Thanks for taking the time to report a bug in 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)._
  -->

**Describe the bug**
A clear and concise description of what the bug is.
The following error is shown when the server has started:

`Error 111 connecting to localhost:XXXX.`

This happens on local machines when --prod_env flag is used.


**To Reproduce**
Steps to reproduce the behavior:
 1. Start server using `python -m scripts.start --prod_env`.
 2. Wait for server to start.
 3. Go to localhost:8181/
 4. See the following error thrown: `Error 111 connecting to localhost:XXXX.`


**Observed behavior**
A clear and concise description of what you have observed.

An error is thrown when the server has started.

**Expected behavior**
A clear and concise description of what you expected to happen.

There should be no server error when the server has started.

**Screenshots**
If applicable, add screenshots to help explain your problem.
![image](https://user-images.githubusercontent.com/11008603/92551818-abc67d00-f27c-11ea-874d-2096c0227df8.png)


**Desktop (please complete the following information; delete this section if the issue does not arise on desktop):**
 - OS: Ubuntu 20.04
 - Browser: Chrome 85


Discussion:

Resolving patch:
diff --git a/scripts/start.py b/scripts/start.py
--- a/scripts/start.py
+++ b/scripts/start.py
@@ -154,7 +154,7 @@ def main(args=None):
         # Give webpack few seconds to do the initial compilation.
         time.sleep(10)
 
-        common.start_redis_server()
+    common.start_redis_server()
 
     python_utils.PRINT('Starting GAE development server')
     background_processes.append(subprocess.Popen(


Test patch:
Repository: oppia/oppia

Issue:
Address typos and grammatical errors
**Describe the bug**
This is a follow up to PR #10764:

@BenHenning made a [comment](https://github.com/oppia/oppia/pull/10764#discussion_r494008908) that my error messages for base_model_validators.ERROR_CATEGORY_FIELD_CHECK errors should say 'expected model' instead of 'expect model'. This needs to be corrected for all of the base_model_validators.ERROR_CATEGORY_FIELD_CHECK error messages in prod_validators.py and prod_validators_test.py

In addition, @BenHenning made a [comment](https://github.com/oppia/oppia/pull/10764#discussion_r494009776) about me typing recieved instead of received. I looked in the codebase and saw that there were other instances of recieved that I could correct.


Discussion:

Resolving patch:
diff --git a/core/domain/state_domain.py b/core/domain/state_domain.py
--- a/core/domain/state_domain.py
+++ b/core/domain/state_domain.py
@@ -728,7 +728,7 @@ def _validate_customization_args(self):
                     raise utils.ValidationError(
                         'Expected customization arg value to be a '
                         'InteractionCustomizationArg domain object, '
-                        'recieved %s' % self.customization_args[ca_name])
+                        'received %s' % self.customization_args[ca_name])
 
         interaction = interaction_registry.Registry.get_interaction_by_id(
             self.id)
diff --git a/core/domain/stats_services.py b/core/domain/stats_services.py
--- a/core/domain/stats_services.py
+++ b/core/domain/stats_services.py
@@ -1247,7 +1247,7 @@ def delete_learner_answer_info(
 def update_state_reference(
         entity_type, old_state_reference, new_state_reference):
     """Updates the state_reference field of the LearnerAnswerDetails model
-    instance with the new_state_reference recieved and then saves the instance
+    instance with the new_state_reference received and then saves the instance
     in the datastore.
 
     Args:


Test patch:
Repository: oppia/oppia

Issue:
Regex in _get_plain_text_from_html_content_string in suggestion_services could be simpler
**Describe the bug**
The regex used to replace all the <oppia-noninteractive-**> tags with their rte component names capitalized in square brackets in the _get_plain_text_from_html_content_string method in suggestion services could be simpler.

**Additional context**
This is a follow up to this [comment](https://github.com/oppia/oppia/pull/10860#discussion_r505288910) in PR #10860

Regex in _get_plain_text_from_html_content_string in suggestion_services could be simpler
**Describe the bug**
The regex used to replace all the <oppia-noninteractive-**> tags with their rte component names capitalized in square brackets in the _get_plain_text_from_html_content_string method in suggestion services could be simpler.

**Additional context**
This is a follow up to this [comment](https://github.com/oppia/oppia/pull/10860#discussion_r505288910) in PR #10860



Discussion:

Resolving patch:
diff --git a/core/domain/suggestion_services.py b/core/domain/suggestion_services.py
--- a/core/domain/suggestion_services.py
+++ b/core/domain/suggestion_services.py
@@ -694,7 +694,7 @@ def _replace_rte_tag(rte_tag):
     # Replace all the <oppia-noninteractive-**> tags with their rte component
     # names capitalized in square brackets.
     html_content_string_with_rte_tags_replaced = re.sub(
-        r'<(oppia-noninteractive-.+?)[^>]+>(.*?)</oppia-noninteractive-.+?>',
+        r'<oppia-noninteractive-[^>]+>(.*?)</oppia-noninteractive-[^>]+>',
         _replace_rte_tag, html_content_string)
     # Get rid of all of the other html tags.
     plain_text = html_cleaner.strip_html_tags(


Test patch:
Repository: oppia/oppia

Issue:
Add test coverage for eslint checks
Add test coverage for eslint checks. See if we can use [nyc](https://www.google.com/url?sa=t&rct=j&q=&esrc=s&source=web&cd=&cad=rja&uact=8&ved=2ahUKEwivs4zuvM3rAhUozzgGHTpcCGkQFjACegQIBBAB&url=https%3A%2F%2Fmedium.com%2F%40asemiloore%2Fnodejs-testing-with-mocha-and-code-coverage-with-nyc-9d1d6e428ac1&usg=AOvVaw00Ju9zWuXh4J3QvrWr11Nz)
Add test coverage for eslint checks
Add test coverage for eslint checks. See if we can use [nyc](https://www.google.com/url?sa=t&rct=j&q=&esrc=s&source=web&cd=&cad=rja&uact=8&ved=2ahUKEwivs4zuvM3rAhUozzgGHTpcCGkQFjACegQIBBAB&url=https%3A%2F%2Fmedium.com%2F%40asemiloore%2Fnodejs-testing-with-mocha-and-code-coverage-with-nyc-9d1d6e428ac1&usg=AOvVaw00Ju9zWuXh4J3QvrWr11Nz)


Discussion:

Resolving patch:
diff --git a/scripts/linters/pre_commit_linter.py b/scripts/linters/pre_commit_linter.py
--- a/scripts/linters/pre_commit_linter.py
+++ b/scripts/linters/pre_commit_linter.py
@@ -572,6 +572,7 @@ def main(args=None):
 
     errors_stacktrace = concurrent_task_utils.ALL_ERRORS
     if errors_stacktrace:
+        failed = True
         _print_errors_stacktrace(errors_stacktrace)
 
     if failed:


Test patch:
diff --git a/scripts/run_custom_eslint_tests.py b/scripts/run_custom_eslint_tests.py
--- a/scripts/run_custom_eslint_tests.py
+++ b/scripts/run_custom_eslint_tests.py
@@ -20,6 +20,7 @@
 from __future__ import unicode_literals  # pylint: disable=import-only-modules
 
 import os
+import re
 import subprocess
 import sys
 
@@ -30,9 +31,10 @@
 def main():
     """Run the tests."""
     node_path = os.path.join(common.NODE_PATH, 'bin', 'node')
+    nyc_path = os.path.join('node_modules', 'nyc', 'bin', 'nyc.js')
     mocha_path = os.path.join('node_modules', 'mocha', 'bin', 'mocha')
     filepath = 'scripts/linters/custom_eslint_checks/rules/'
-    proc_args = [node_path, mocha_path, filepath]
+    proc_args = [node_path, nyc_path, mocha_path, filepath]
 
     proc = subprocess.Popen(
         proc_args, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
@@ -54,6 +56,15 @@ def main():
         python_utils.PRINT('All tests passed')
         python_utils.PRINT('---------------------------')
 
+    coverage_result = re.search = re.search(
+        r'All files\s*\|\s*(?P<stmts>\S+)\s*\|\s*(?P<branch>\S+)\s*\|\s*'
+        r'(?P<funcs>\S+)\s*\|\s*(?P<lines>\S+)\s*\|\s*', tests_stdout)
+    if (coverage_result.group('stmts') != '100' or
+            coverage_result.group('branch') != '100' or
+            coverage_result.group('funcs') != '100' or
+            coverage_result.group('lines') != '100'):
+        raise Exception('Eslint test coverage is not 100%')
+
 
 if __name__ == '__main__':
     main()
Repository: oppia/oppia

Issue:
Unable to export user data in JSON format
<!--
  - Thanks for taking the time to report a bug in 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)._
  -->

**Describe the bug**
When attempting to export user data in JSON format, there is an internal server error (500) and the data is not downloaded.

**To Reproduce**
Steps to reproduce the behavior:
 1. Go to the Preferences page
 2. Click on "Export account"

**Observed behavior**
There is an internal server error and the data cannot be downloaded.

**Expected behavior**
The user data should be downloaded.

**Screenshots**
<img width="1268" alt="Screen Shot 2020-12-15 at 10 29 18" src="https://user-images.githubusercontent.com/17547686/102299092-36b3b500-3f07-11eb-84c6-52176b780a67.png">

**Desktop (please complete the following information; delete this section if the issue does not arise on desktop):**
 - OS: macOS Mojave
 - Browser: Firefox/Chrome
 - Version: 83.0/87



Discussion:

Resolving patch:
diff --git a/core/controllers/profile.py b/core/controllers/profile.py
--- a/core/controllers/profile.py
+++ b/core/controllers/profile.py
@@ -386,8 +386,10 @@ def get(self):
             zfile.writestr('oppia_takeout_data.json', json.dumps(user_data))
             for image in user_images:
                 b64_png_no_header = image.b64_image_data.split(',')[1]
-                decoded_png = base64.b64decode(
-                    python_utils.url_unquote_plus(b64_png_no_header))
+                b64_png_no_header = python_utils.url_unquote_plus(
+                    b64_png_no_header)
+                b64_png_no_header = re.sub(r'\s', b'+', b64_png_no_header)
+                decoded_png = base64.b64decode(b64_png_no_header)
                 zfile.writestr('images/' + image.image_export_path, decoded_png)
 
         # Render file for download.


Test patch:
Repository: oppia/oppia

Issue:
[Contributor Dashboard] The "opportunity deleted" text seems to intersect with the translation text
<!--
  - Thanks for taking the time to report a bug in 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)._
  -->

**Describe the bug**
Text shown for deleted opportunities seems odd.

**To Reproduce**
Steps to reproduce the behavior:
 
If an opportunity corresponding to a translation is deleted and the author of the submitted translation views the contributor dashboard page. It looks like this:

![image](https://user-images.githubusercontent.com/11008603/103948047-21752380-515f-11eb-93d4-a8bffa01f7e1.png)

The "opportunity deleted" text seems to intersect with the translation text.

Browser: Chrome 87



Discussion:

Resolving patch:
diff --git a/core/domain/suggestion_services.py b/core/domain/suggestion_services.py
--- a/core/domain/suggestion_services.py
+++ b/core/domain/suggestion_services.py
@@ -20,6 +20,7 @@
 from __future__ import unicode_literals  # pylint: disable=import-only-modules
 
 import heapq
+import logging
 import re
 
 from constants import constants
@@ -1244,6 +1245,9 @@ def _update_suggestion_counts_in_community_contribution_stats_transactional(
     stats_model.update_timestamps()
     stats_model.put()
 
+    logging.info('Updated translation_suggestion_counts_by_lang_code: %s' % (
+        stats_model.translation_suggestion_counts_by_lang_code))
+
 
 def _update_suggestion_counts_in_community_contribution_stats(
         suggestions, amount):


Test patch:
Repository: oppia/oppia

Issue:
Broken hyperlinks and lost information
<!--
  - Thanks for taking the time to report a bug in 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)._
  -->

With the implimentation of new pages few of the links have been broken  and also some valuable information present on the old pages such as the participation playbook have been lost.


**Screenshots**
If applicable, add screenshots to help explain your problem.
![Screenshot from 2021-03-01 23-07-41](https://user-images.githubusercontent.com/68547101/109643297-0a105080-7b7a-11eb-918d-eb9939f4ade5.png)
![Screenshot from 2021-03-01 23-07-53](https://user-images.githubusercontent.com/68547101/109643305-0d0b4100-7b7a-11eb-85cf-12b86c212a4e.png)


Broken hyperlinks and lost information
<!--
  - Thanks for taking the time to report a bug in 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)._
  -->

With the implimentation of new pages few of the links have been broken  and also some valuable information present on the old pages such as the participation playbook have been lost.


**Screenshots**
If applicable, add screenshots to help explain your problem.
![Screenshot from 2021-03-01 23-07-41](https://user-images.githubusercontent.com/68547101/109643297-0a105080-7b7a-11eb-918d-eb9939f4ade5.png)
![Screenshot from 2021-03-01 23-07-53](https://user-images.githubusercontent.com/68547101/109643305-0d0b4100-7b7a-11eb-85cf-12b86c212a4e.png)




Discussion:
Can you pls share the URL at which hyperlinks are broken? 
Can you pls share the URL at which hyperlinks are broken? 

Resolving patch:
diff --git a/scripts/build.py b/scripts/build.py
--- a/scripts/build.py
+++ b/scripts/build.py
@@ -122,6 +122,7 @@
     'webpack_bundles/donate-page.mainpage.html',
     'webpack_bundles/get-started-page.mainpage.html',
     'webpack_bundles/privacy-page.mainpage.html',
+    'webpack_bundles/playbook.mainpage.html',
     'webpack_bundles/teach-page.mainpage.html',
     'webpack_bundles/terms-page.mainpage.html',
     'webpack_bundles/thanks-page.mainpage.html'


Test patch: