Fix recommendation getting if non-code recommendation was received: we shouldn't...
[idea/community.git] / python / educational-core / student / src / com / jetbrains / edu / learning / stepic / EduAdaptiveStepicConnector.java
index 77e4a2a8333e35db7321638998aeea0c636ce7d9..582f546cea9bc966a250bb42e50f44a4940d1ad1 100644 (file)
@@ -101,18 +101,12 @@ public class EduAdaptiveStepicConnector {
               if (step.block.name.equals("code")) {
                 return getTaskFromStep(project, stepId, step.block, realLesson.getName());
               }
-              else {
-                final StudyEditor editor = StudyUtils.getSelectedStudyEditor(project);
-                if (editor != null && editor.getTaskFile() != null) {
-                  final StepicUser user = StudyTaskManager.getInstance(project).getUser();
-                  postRecommendationReaction(project, String.valueOf(editor.getTaskFile().getTask().getLesson().getId()),
-                                             String.valueOf(user.getId()), -1);
-                  return getNextRecommendation(project, course);
-                }
-              }
             }
 
-            LOG.warn("Got a lesson without code part as a recommendation");
+            final StepicUser user = StudyTaskManager.getInstance(project).getUser();
+            postRecommendationReaction(project, lessonId,
+                                       String.valueOf(user.getId()), -1);
+            return getNextRecommendation(project, course);
           }
           else {
             LOG.warn("Got unexpected number of lessons: " + lessonContainer.lessons.size());