Repository: oppia/oppia

Issue:
Bugs during student user journey
<!--
  - 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**
1-
![Screenshot from 2020-12-15 02-58-11](https://user-images.githubusercontent.com/62715691/102213709-24cd1480-3efd-11eb-95e7-00e1a24c0f31.png)
error in console while dragging for correct answer.

Steps to reproduce:
1. go to https://oppiatestserver.appspot.com/learn/math/fractions/practice/session?selected_subtopic_ids=1.
2. go to the question which uses dragging interaction, drag items to se error.

2-
![Screenshot from 2020-12-15 16-59-59](https://user-images.githubusercontent.com/62715691/102213814-4f1ed200-3efd-11eb-9fc9-9682ec7d450f.png)
error after the completion of a practice lesson in console.

Steps to reproduce:
1. go to https://oppiatestserver.appspot.com/learn/math/fractions/practice/session?selected_subtopic_ids=1 
2. complete a lesson and see error at the end.

 3-
 https://drive.google.com/file/d/1FRC6MZ1mEX8ZLDjNzZvy-k3Ee3sz7DGT/view?usp=sharing
error in console while scrolling lessons.
 
Steps to reproduce:
1. go to https://oppiatestserver.appspot.com/search/find?q= scroll and see errors.

**Desktop (please complete the following information; delete this section if the issue does not arise on desktop):**
 - OS: Ubuntu 20.04
 - Browser chrome

No Visible Error When Reusing Exploration in Story
<!--
  - 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 assigning to a new story an exploration that has already been linked to a story, there is a console error but no visible error.

**To Reproduce**
Steps to reproduce the behavior:
 1. Create an exploration
 2. Create a story
 3. Assign the exploration to the story
 4. Create another story
 5. Try and assign the exploration to the new story too

**Observed behavior**
A console error like this: `The exploration with ID 9V3qBHQs2RF5 is already linked to story with ID aXZnFuYggRf0` and a failure to save, but no error shown to the user.

**Expected behavior**
Error shown to user

**Desktop (please complete the following information; delete this section if the issue does not arise on desktop):**
 - OS: macOS
 - Browser: Firefox 83, Chrome 87
No Visible Error When Reusing Exploration in Story
<!--
  - 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 assigning to a new story an exploration that has already been linked to a story, there is a console error but no visible error.

**To Reproduce**
Steps to reproduce the behavior:
 1. Create an exploration
 2. Create a story
 3. Assign the exploration to the story
 4. Create another story
 5. Try and assign the exploration to the new story too

**Observed behavior**
A console error like this: `The exploration with ID 9V3qBHQs2RF5 is already linked to story with ID aXZnFuYggRf0` and a failure to save, but no error shown to the user.

**Expected behavior**
Error shown to user

**Desktop (please complete the following information; delete this section if the issue does not arise on desktop):**
 - OS: macOS
 - Browser: Firefox 83, Chrome 87


Discussion:
Assigning to @aks681 as the LACE team lead since this is an error in the learner experience. @aks681 could you either take this issue up or assign it to someone else on the LACE team who can get it fixed quickly?
Assigning to @aks681 as the LACE team lead since this is an error in the creator experience. @aks681 could you either take this issue up or assign it to someone else on the LACE team who can get it fixed quickly?

/cc @Showtim3 since they worked on these new editors
Assigning to @aks681 as the LACE team lead since this is an error in the creator experience. @aks681 could you either take this issue up or assign it to someone else on the LACE team who can get it fixed quickly?

/cc @Showtim3 since they worked on these new editors

Resolving patch:
diff --git a/core/domain/story_services.py b/core/domain/story_services.py
--- a/core/domain/story_services.py
+++ b/core/domain/story_services.py
@@ -581,6 +581,20 @@ def update_story(
     new_story, exp_ids_removed_from_story, exp_ids_added_to_story = (
         apply_change_list(story_id, change_list))
     story_is_published = _is_story_published_and_present_in_topic(new_story)
+    exploration_context_models_to_be_deleted = (
+        exp_models.ExplorationContextModel.get_multi(
+            exp_ids_removed_from_story))
+    exploration_context_models_to_be_deleted = [
+        model for model in exploration_context_models_to_be_deleted
+        if model is not None]
+    exploration_context_models_collisions_list = (
+        exp_models.ExplorationContextModel.get_multi(
+            exp_ids_added_to_story))
+    for context_model in exploration_context_models_collisions_list:
+        if context_model is not None and context_model.story_id != story_id:
+            raise utils.ValidationError(
+                'The exploration with ID %s is already linked to story '
+                'with ID %s' % (context_model.id, context_model.story_id))
 
     if (
             old_story.url_fragment != new_story.url_fragment and
@@ -597,24 +611,9 @@ def update_story(
     suggestion_services.auto_reject_translation_suggestions_for_exp_ids(
         exp_ids_removed_from_story)
 
-    exploration_context_models_to_be_deleted = (
-        exp_models.ExplorationContextModel.get_multi(
-            exp_ids_removed_from_story))
-    exploration_context_models_to_be_deleted = [
-        model for model in exploration_context_models_to_be_deleted
-        if model is not None]
     exp_models.ExplorationContextModel.delete_multi(
         exploration_context_models_to_be_deleted)
 
-    exploration_context_models_collisions_list = (
-        exp_models.ExplorationContextModel.get_multi(
-            exp_ids_added_to_story))
-    for context_model in exploration_context_models_collisions_list:
-        if context_model is not None and context_model.story_id != story_id:
-            raise utils.ValidationError(
-                'The exploration with ID %s is already linked to story '
-                'with ID %s' % (context_model.id, context_model.story_id))
-
     new_exploration_context_models = [exp_models.ExplorationContextModel(
         id=exp_id,
         story_id=story_id
diff --git a/scripts/linters/general_purpose_linter.py b/scripts/linters/general_purpose_linter.py
--- a/scripts/linters/general_purpose_linter.py
+++ b/scripts/linters/general_purpose_linter.py
@@ -268,7 +268,8 @@
             'core/templates/pages/exploration-editor-page/translation-tab/'
             'audio-translation-bar/audio-translation-bar.directive.spec.ts',
             'core/templates/pages/library-page/search-bar/'
-            'search-bar.component.spec.ts'),
+            'search-bar.component.spec.ts',
+            'core/templates/pages/splash-page/splash-page.component.spec.ts'),
         'excluded_dirs': ()
     },
     {


Test patch: