Repository: oppia/oppia

Issue:
Prerequisite skill ID in Add response modal does not accept symbols(Failure)
<!--
  - 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)._
  -->

**Description**
Prerequisite skill ID in Add response modal does not accept symbols. This might be an unexpected behavior in a number of cases. For example, C#, C++.

Even if we decide that we decide not to allow symbols in prerequisite skill ID, a failure happens on following the steps shown below:
 1. Create an exploration
 2. Add a multiple choice interaction.
 3. Add Options
 4. Click on ```Save Interaction```.
 5. Write a symbol-containing prerequisite skill id.
 6. Click on "And afterwards, directs the learner to..." dropdown.
 7. Choose any option other than "Try again".
 8. Click "Save response"
 9. See error.

**Observed behavior**
![screenshot from 2019-02-05 18-38-10](https://user-images.githubusercontent.com/32777813/52276598-a4d8d980-2978-11e9-8b18-f7cf5e6d7862.png)


**Expected behavior**
The Save response button should be blocked, just like it is when "Try again" is selected in "And afterwards, directs the learner to..." dropdown.
Also, I do not understand why we need to hide the Prerequisite skill id input when any option other than try again is selected. Upon further discussion, we need to decide if it is necessary to do so.
Prerequisite skill ID in Add response modal does not accept symbols(Failure)
<!--
  - 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)._
  -->

**Description**
Prerequisite skill ID in Add response modal does not accept symbols. This might be an unexpected behavior in a number of cases. For example, C#, C++.

Even if we decide that we decide not to allow symbols in prerequisite skill ID, a failure happens on following the steps shown below:
 1. Create an exploration
 2. Add a multiple choice interaction.
 3. Add Options
 4. Click on ```Save Interaction```.
 5. Write a symbol-containing prerequisite skill id.
 6. Click on "And afterwards, directs the learner to..." dropdown.
 7. Choose any option other than "Try again".
 8. Click "Save response"
 9. See error.

**Observed behavior**
![screenshot from 2019-02-05 18-38-10](https://user-images.githubusercontent.com/32777813/52276598-a4d8d980-2978-11e9-8b18-f7cf5e6d7862.png)


**Expected behavior**
The Save response button should be blocked, just like it is when "Try again" is selected in "And afterwards, directs the learner to..." dropdown.
Also, I do not understand why we need to hide the Prerequisite skill id input when any option other than try again is selected. Upon further discussion, we need to decide if it is necessary to do so.


Discussion:
Hi @rakshitkumarcse, Is this reproducible on the main site? If no, then its a regression and we need to fix this for the current release. Thanks!
Hey @bansalnitish
It is not reproducible on main site. We need to fix this for the current release.
Thanks.
Thanks for the update!
No problem. :)
I'll take a look at this as this came as a consequence of enabling the ENABLE_NEW_STRUCTURE_EDITORS flag.
This works, in the sense that the prerequisite skill ID field takes only skill ids which are similar to exploration ids (i.e they are IDs of the skill construct). So, only an input which has valid ID characters are allowed. Will modify the response such that this is evident to a creator.
Also, will restrict this functionality to only whitelisted explorations, as it was supposed to be.
Hi @aks681, any updates on this ? We need to fix this for current release.
Yeah, I am doing it. Will create PR today.
Hi @rakshitkumarcse, Is this reproducible on the main site? If no, then its a regression and we need to fix this for the current release. Thanks!
Hey @bansalnitish
It is not reproducible on main site. We need to fix this for the current release.
Thanks.
Thanks for the update!
No problem. :)
I'll take a look at this as this came as a consequence of enabling the ENABLE_NEW_STRUCTURE_EDITORS flag.
This works, in the sense that the prerequisite skill ID field takes only skill ids which are similar to exploration ids (i.e they are IDs of the skill construct). So, only an input which has valid ID characters are allowed. Will modify the response such that this is evident to a creator.
Also, will restrict this functionality to only whitelisted explorations, as it was supposed to be.
Hi @aks681, any updates on this ? We need to fix this for current release.
Yeah, I am doing it. Will create PR today.

Resolving patch:
diff --git a/core/controllers/features.py b/core/controllers/features.py
--- a/core/controllers/features.py
+++ b/core/controllers/features.py
@@ -37,6 +37,6 @@ def get(self, exploration_id):
         self.render_json({
             'is_improvements_tab_enabled':
                 config_domain.IS_IMPROVEMENTS_TAB_ENABLED.value,
-            'is_playthrough_recording_enabled':
-                exploration_id in whitelisted_exploration_ids_for_playthroughs,
+            'is_exploration_whitelisted':
+                exploration_id in whitelisted_exploration_ids_for_playthroughs
         })


Test patch:
diff --git a/core/controllers/features_test.py b/core/controllers/features_test.py
--- a/core/controllers/features_test.py
+++ b/core/controllers/features_test.py
@@ -51,7 +51,7 @@ def test_can_record_playthroughs_in_whitelisted_explorations(self):
 
         json_response = self.get_json(exploration_features_url(self.EXP_ID))
 
-        self.assertTrue(json_response['is_playthrough_recording_enabled'])
+        self.assertTrue(json_response['is_exploration_whitelisted'])
 
     def test_can_not_record_playthroughs_with_empty_whitelist(self):
         self.set_config_property(
@@ -60,7 +60,7 @@ def test_can_not_record_playthroughs_with_empty_whitelist(self):
 
         json_response = self.get_json(exploration_features_url(self.EXP_ID))
 
-        self.assertFalse(json_response['is_playthrough_recording_enabled'])
+        self.assertFalse(json_response['is_exploration_whitelisted'])
 
     def test_can_not_record_playthroughs_for_exploration_not_in_whitelist(self):
         self.set_config_property(
@@ -69,7 +69,7 @@ def test_can_not_record_playthroughs_for_exploration_not_in_whitelist(self):
 
         json_response = self.get_json(exploration_features_url(self.EXP_ID))
 
-        self.assertFalse(json_response['is_playthrough_recording_enabled'])
+        self.assertFalse(json_response['is_exploration_whitelisted'])
 
 
 class ExplorationImprovementsTabFeatureTest(ExplorationFeaturesTestBase):