Repository: oppia/oppia

Issue:
Getting console errors while previewing a skill in the skill editor
<!--
  - 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**
Getting errors from the preview tab of the skill editor

**To Reproduce**
Steps to reproduce the behavior:
 1. Go to the topics and skills dashboard
 2. choose a topic with skills ( e.g [this one](https://www.oppiatestserver.org/skill_editor/cg3FiO2ixbls#/preview) )
 3. Go to inspect.
 4. See those errors in red.

**Observed behavior**
Errors in the console tab ( within inspect )

**Expected behavior**
A clear and concise description of what you expected to happen.

**Screenshots / Videos**

In Chrome

![Screenshot from 2022-06-06 11-02-49](https://user-images.githubusercontent.com/89520981/172100988-549fb4f0-1bdb-481f-9d83-9d2ba18e6b9a.png)

In Firefox

![Screenshot from 2022-06-06 11-08-35](https://user-images.githubusercontent.com/89520981/172101772-40af2d12-cd71-4ca2-9b3c-369f0d13a167.png)


**Desktop:**
 - OS: Ubuntu
 - Browser: Chrome, Firefox
 - Browser-version: 102.0
 
*NOTE: I found those errors only in that mentioned skill.
Console error while loading pencil code editor
<!--
  - 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**
Console error while loading pencil code editor

**To Reproduce**
Steps to reproduce the behavior:
 1. Go to https://oppiatestserver.appspot.com/create/16
 2. Click on Pencil code editor under exploration overview
 3. Click on preview
 4. See error in console

**Observed behavior**
There is error in console while loading pencil code editor

**Expected behavior**
There should not be any console error

**Screenshots**
![Screenshot from 2022-06-05 13-56-04](https://user-images.githubusercontent.com/86483059/172042275-4737dd2a-71ed-40ed-ac50-66819c6aedf6.png)

**Desktop (please complete the following information; delete this section if the issue does not arise on desktop):**
 - OS: Ubuntu 21
 - Browser: Chrome
 - Browser-version: 101

**Smartphone (please complete the following information; delete this section if the issue does not arise on smartphones):**
 - Device: [e.g. iPhone6]
 - OS: [e.g. iOS8.1]
 - Browser: [e.g. stock browser, safari]
 - Browser-version: [e.g. 22]

**Additional context**
Add any other context about the problem here.

Improper working of `ImageClickInput` interaction in Skill editor.
<!--
  - 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**
Not able to create image in ImageClickInput interaction.

**To Reproduce**
Steps to reproduce the behavior:
 1. Go to topic and skill dashboard.
 2. Select any skill and open its editor.
 3. From the editor open the questions tab and add a new question. 
 5. In question, use Image Region interaction and use `create` option to create a new image. 

**Observed behavior**
No image is produced when clicking on `Use this image`

**Expected behavior**
Image should be produced when clicking on `Use this image`

**Screenshots / Videos**

https://user-images.githubusercontent.com/12553576/172158195-19cdc33f-d080-4ee1-9bd6-aa67affe1f59.mp4



https://user-images.githubusercontent.com/12553576/172158213-78cf146d-7027-43fe-a760-5a53b6592d56.mp4

**Desktop (please complete the following information; delete this section if the issue does not arise on desktop):**
 - OS: ubuntu
 - Browser: Mozilla firefox 
 - Browser-version: 100.0.2

**Additional context**
The same behavior is observed in google chrome.
Console errors while interacting with Item Selection Interaction
<!--
  - 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**
Selecting items and submitting the response on the Item Selection interaction leads to a server error.

**To Reproduce**
Steps to reproduce the behavior:
 1. Go to the [Test Server](https://oppiatestserver.org)
 2. Play through Lesson 1 of the fractions topic
 3. Reach the item selection an interaction and submit a response
 4. See error on the console

**Observed behavior**
A console error is encountered

**Expected behavior**
No console errors should happen

**Screenshots / Videos**
![image](https://user-images.githubusercontent.com/73544247/172057884-fd171f5d-a1d3-4782-8c92-915c65454760.png)


**Desktop (please complete the following information; delete this section if the issue does not arise on desktop):**
 - OS: Linux, Windows
 - Browser: Chrome, Firefox



Discussion:
@aks681 @kevintab95 PTAL
@aks681 @kevintab95 Please assign this to someone.
@aks681 @kevintab95 PTAL
@aks681 @kevintab95 Please assign this to someone.

Resolving patch:
diff --git a/core/controllers/reader.py b/core/controllers/reader.py
--- a/core/controllers/reader.py
+++ b/core/controllers/reader.py
@@ -534,7 +534,7 @@ class AnswerSubmittedEventHandler(base.BaseHandler):
                     'values': {
                         'schema': {
                             'type': 'weak_multiple',
-                            'options': ['int', 'basestring', 'dict']
+                            'options': ['int', 'basestring', 'dict', 'list']
                         }
                     }
                 },
@@ -557,7 +557,7 @@ class AnswerSubmittedEventHandler(base.BaseHandler):
             'answer': {
                 'schema': {
                     'type': 'weak_multiple',
-                    'options': ['int', 'basestring', 'dict']
+                    'options': ['int', 'basestring', 'dict', 'list']
                 }
             },
             'client_time_spent_in_secs': {
@@ -980,7 +980,7 @@ class ExplorationCompleteEventHandler(base.BaseHandler):
                     'values': {
                         'schema': {
                             'type': 'weak_multiple',
-                            'options': ['int', 'basestring', 'dict']
+                            'options': ['int', 'basestring', 'dict', 'list']
                         }
                     }
                 }
@@ -1098,7 +1098,7 @@ class ExplorationMaybeLeaveHandler(base.BaseHandler):
                     'values': {
                         'schema': {
                             'type': 'weak_multiple',
-                            'options': ['int', 'basestring', 'dict']
+                            'options': ['int', 'basestring', 'dict', 'list']
                         }
                     }
                 }


Test patch:
diff --git a/core/controllers/reader_test.py b/core/controllers/reader_test.py
--- a/core/controllers/reader_test.py
+++ b/core/controllers/reader_test.py
@@ -1990,7 +1990,7 @@ def test_submit_answer_for_exp_raises_error_with_no_answer_matching_type(
             '/explorehandler/answer_submitted_event/%s' % exp_id,
             {
                 'old_state_name': state_name_1,
-                'answer': [],
+                'answer': 1.1,
                 'version': version,
                 'client_time_spent_in_secs': 0,
                 'session_id': '1PZTCw9JY8y-8lqBeuoJS2ILZMxa5m8N',
@@ -2003,7 +2003,7 @@ def test_submit_answer_for_exp_raises_error_with_no_answer_matching_type(
         self.assertEqual(
             response['error'],
             'Schema validation for \'answer\' failed: ' +
-            'Type of [] is not present in options'
+            'Type of 1.1 is not present in options'
         )