Fix recommendation getting if non-code recommendation was received: we shouldn't...
authorValentina Kiryushkina <valentina.kiryushkina@jetbrains.com>
Sat, 6 Aug 2016 15:33:10 +0000 (18:33 +0300)
committerValentina Kiryushkina <valentina.kiryushkina@jetbrains.com>
Sat, 6 Aug 2016 16:40:29 +0000 (19:40 +0300)
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());