Fix according to review IDEA-CR-11509: extract api url for stepic and stepic adaptive...
authorValentina Kiryushkina <valentina.kiryushkina@jetbrains.com>
Thu, 16 Jun 2016 13:02:06 +0000 (16:02 +0300)
committerValentina Kiryushkina <valentina.kiryushkina@jetbrains.com>
Fri, 17 Jun 2016 12:56:42 +0000 (15:56 +0300)
python/educational-core/student/src/com/jetbrains/edu/learning/stepic/EduAdaptiveStepicConnector.java
python/educational-core/student/src/com/jetbrains/edu/learning/stepic/EduStepicConnector.java
python/educational-core/student/src/com/jetbrains/edu/learning/stepic/EduStepicNames.java [new file with mode: 0644]
python/educational-python/student-python/src/com/jetbrains/edu/learning/PyStudyCheckAction.java

index 7301a5491c0b852c32f6f7e29f62fb223ce6a7d8..b527720d4af3213148d9c38ce2ce8b28af5f5e2b 100644 (file)
@@ -54,30 +54,17 @@ import static com.jetbrains.edu.learning.stepic.EduStepicConnector.*;
 public class EduAdaptiveStepicConnector {
   public static final String PYTHON27 = "python27";
   public static final String PYTHON3 = "python3";
-
   private static final Logger LOG = Logger.getInstance(EduAdaptiveStepicConnector.class);
-  private static final String STEPIC_URL = "https://stepic.org/";
-  private static final String STEPIC_API_URL = STEPIC_URL + "api/";
-  private static final String RECOMMENDATIONS_URL = "recommendations";
-  private static final String CONTENT_TYPE_APPL_JSON = "application/json";
-  private static final String LESSON_URL = "lessons/";
-  private static final String RECOMMENDATION_REACTIONS_URL = "recommendation-reactions";
-  private static final String ATTEMPTS_URL = "attempts";
-  private static final String SUBMISSION_URL = "submissions";
-  private static final String ASSIGNMENT_URL = "/assignments";
-  private static final String VIEWS_URL = "/views";
-  private static final String UNITS_URL = "/units";
-  private static final String DEFAULT_TASKFILE_NAME = "code.py";
 
   @Nullable
   public static Task getNextRecommendation(@NotNull final Project project, @NotNull Course course) {
     try {
       final CloseableHttpClient client = getHttpClient(project);
-      final URI uri = new URIBuilder(STEPIC_API_URL + RECOMMENDATIONS_URL)
-        .addParameter("course", String.valueOf(course.getId()))
+      final URI uri = new URIBuilder(EduStepicNames.STEPIC_API_URL + EduStepicNames.RECOMMENDATIONS_URL)
+        .addParameter(EduNames.COURSE, String.valueOf(course.getId()))
         .build();
       final HttpGet request = new HttpGet(uri);
-      setHeaders(request, CONTENT_TYPE_APPL_JSON);
+      setHeaders(request, EduStepicNames.CONTENT_TYPE_APPL_JSON);
 
       final CloseableHttpResponse response = client.execute(request);
       final StatusLine statusLine = response.getStatusLine();
@@ -92,7 +79,7 @@ public class EduAdaptiveStepicConnector {
           final StepicWrappers.Recommendation recommendation = recomWrapper.recommendations[0];
           final String lessonId = recommendation.lesson;
           final StepicWrappers.LessonContainer
-            lessonContainer = getFromStepic(LESSON_URL + lessonId, StepicWrappers.LessonContainer.class);
+            lessonContainer = getFromStepic(EduStepicNames.LESSONS + lessonId, StepicWrappers.LessonContainer.class);
           if (lessonContainer.lessons.size() == 1) {
             final Lesson realLesson = lessonContainer.lessons.get(0);
             course.getLessons().get(0).id = Integer.parseInt(lessonId);
@@ -127,14 +114,14 @@ public class EduAdaptiveStepicConnector {
   }
 
   private static void viewAllSteps(CloseableHttpClient client, int lessonId) throws URISyntaxException, IOException {
-    final URI unitsUrl = new URIBuilder(UNITS_URL).addParameter("lesson", String.valueOf(lessonId)).build();
+    final URI unitsUrl = new URIBuilder(EduStepicNames.UNITS).addParameter(EduNames.LESSON, String.valueOf(lessonId)).build();
     final StepicWrappers.UnitContainer unitContainer = getFromStepic(unitsUrl.toString(), StepicWrappers.UnitContainer.class);
     if (unitContainer.units.size() != 1) {
       LOG.warn("Got unexpected numbers of units: " + unitContainer.units.size());
       return;
     }
 
-    final URIBuilder builder = new URIBuilder(ASSIGNMENT_URL);
+    final URIBuilder builder = new URIBuilder(EduStepicNames.ASSIGNMENT);
     for (Integer step : unitContainer.units.get(0).assignments) {
       builder.addParameter("ids[]", String.valueOf(step));
     }
@@ -142,10 +129,10 @@ public class EduAdaptiveStepicConnector {
     final StepicWrappers.AssignmentsWrapper assignments = getFromStepic(assignmentUrl.toString(), StepicWrappers.AssignmentsWrapper.class);
     if (assignments.assignments.size() > 0) {
       for (StepicWrappers.Assignment assignment : assignments.assignments) {
-        final HttpPost post = new HttpPost(STEPIC_API_URL + VIEWS_URL);
+        final HttpPost post = new HttpPost(EduStepicNames.STEPIC_API_URL + EduStepicNames.VIEWS_URL);
         final StepicWrappers.ViewsWrapper viewsWrapper = new StepicWrappers.ViewsWrapper(assignment.id, assignment.step);
         post.setEntity(new StringEntity(new Gson().toJson(viewsWrapper)));
-        setHeaders(post, CONTENT_TYPE_APPL_JSON);
+        setHeaders(post, EduStepicNames.CONTENT_TYPE_APPL_JSON);
         final CloseableHttpResponse viewPostResult = client.execute(post);
         if (viewPostResult.getStatusLine().getStatusCode() != HttpStatus.SC_CREATED) {
           LOG.warn("Error while Views post, code: " + viewPostResult.getStatusLine().getStatusCode());
@@ -159,12 +146,12 @@ public class EduAdaptiveStepicConnector {
 
   public static boolean postRecommendationReaction(@NotNull final Project project, @NotNull final String lessonId,
                                                    @NotNull final String user, int reaction) {
-    final HttpPost post = new HttpPost(STEPIC_API_URL + RECOMMENDATION_REACTIONS_URL);
+    final HttpPost post = new HttpPost(EduStepicNames.STEPIC_API_URL + EduStepicNames.RECOMMENDATION_REACTIONS_URL);
     final String json = new Gson()
       .toJson(new StepicWrappers.RecommendationReactionWrapper(new StepicWrappers.RecommendationReaction(reaction, user, lessonId)));
     post.setEntity(new StringEntity(json, ContentType.APPLICATION_JSON));
     final CloseableHttpClient client = getHttpClient(project);
-    setHeaders(post, CONTENT_TYPE_APPL_JSON);
+    setHeaders(post, EduStepicNames.CONTENT_TYPE_APPL_JSON);
     try {
       final CloseableHttpResponse execute = client.execute(post);
       return execute.getStatusLine().getStatusCode() == HttpStatus.SC_CREATED;
@@ -210,7 +197,7 @@ public class EduAdaptiveStepicConnector {
                                                                                                                        .getDocument()
                                                                                                                        .setText(
                                                                                                                          taskFiles.get(
-                                                                                                                           DEFAULT_TASKFILE_NAME).text)));
+                                                                                                                           EduStepicNames.DEFAULT_TASKFILE_NAME).text)));
             }
             else {
               LOG.warn("Got task without unexpected number of task files: " + taskFiles.size());
@@ -372,7 +359,7 @@ public class EduAdaptiveStepicConnector {
   public static Pair<Boolean, String> checkTask(@NotNull final Project project, @NotNull final Task task) {
     int attemptId = -1;
     try {
-      attemptId = getAttemptId(project, task, ATTEMPTS_URL);
+      attemptId = getAttemptId(project, task, EduStepicNames.ATTEMPTS);
     }
     catch (IOException e) {
       LOG.warn(e.getMessage());
@@ -416,8 +403,8 @@ public class EduAdaptiveStepicConnector {
     try {
       final StepicWrappers.SubmissionToPostWrapper submissionToPostWrapper =
         new StepicWrappers.SubmissionToPostWrapper(String.valueOf(attemptId), language, text);
-      final HttpPost httpPost = new HttpPost(STEPIC_API_URL + SUBMISSION_URL);
-      setHeaders(httpPost, CONTENT_TYPE_APPL_JSON);
+      final HttpPost httpPost = new HttpPost(EduStepicNames.STEPIC_API_URL + EduStepicNames.SUBMISSIONS);
+      setHeaders(httpPost, EduStepicNames.CONTENT_TYPE_APPL_JSON);
       try {
         httpPost.setEntity(new StringEntity(new Gson().toJson(submissionToPostWrapper)));
       }
@@ -441,13 +428,13 @@ public class EduAdaptiveStepicConnector {
     try {
       while (wrapper.submissions.length == 1 && wrapper.submissions[0].status.equals("evaluation")) {
         TimeUnit.MILLISECONDS.sleep(500);
-        final URI submissionURI = new URIBuilder(STEPIC_API_URL + SUBMISSION_URL)
+        final URI submissionURI = new URIBuilder(EduStepicNames.STEPIC_API_URL + EduStepicNames.SUBMISSIONS)
           .addParameter("attempt", String.valueOf(attemptId))
           .addParameter("order", "desc")
           .addParameter("user", String.valueOf(id))
           .build();
         final HttpGet httpGet = new HttpGet(submissionURI);
-        setHeaders(httpGet, CONTENT_TYPE_APPL_JSON);
+        setHeaders(httpGet, EduStepicNames.CONTENT_TYPE_APPL_JSON);
         final CloseableHttpResponse httpResponse = client.execute(httpGet);
         final String entity = EntityUtils.toString(httpResponse.getEntity());
         wrapper = new Gson().fromJson(entity, StepicWrappers.ResultSubmissionWrapper.class);
@@ -489,11 +476,11 @@ public class EduAdaptiveStepicConnector {
   private static int getAttemptId(@NotNull final Project project, @NotNull Task task, @NotNull final String attempts) throws IOException {
     final StepicWrappers.AttemptToPostWrapper attemptWrapper = new StepicWrappers.AttemptToPostWrapper(task.getStepicId());
 
-    final HttpPost post = new HttpPost(STEPIC_API_URL + attempts);
+    final HttpPost post = new HttpPost(EduStepicNames.STEPIC_API_URL + attempts);
     post.setEntity(new StringEntity(new Gson().toJson(attemptWrapper)));
 
     final CloseableHttpClient client = getHttpClient(project);
-    setHeaders(post, CONTENT_TYPE_APPL_JSON);
+    setHeaders(post, EduStepicNames.CONTENT_TYPE_APPL_JSON);
     final CloseableHttpResponse httpResponse = client.execute(post);
     final String entity = EntityUtils.toString(httpResponse.getEntity());
     final StepicWrappers.AttemptContainer container =
index f796dddbaad9e1cf0445bdd266b8e86431f913bf..acfc2c0bfdb4db846e291133a0e3fb4e266b959f 100644 (file)
@@ -54,7 +54,6 @@ import java.util.*;
 public class EduStepicConnector {
   private static final Logger LOG = Logger.getInstance(EduStepicConnector.class.getName());
   private static final String stepicUrl = "https://stepic.org/";
-  private static final String stepicApiUrl = stepicUrl + "api/";
   private static String ourCSRFToken = "";
   private static CloseableHttpClient ourClient;
 
@@ -79,7 +78,7 @@ public class EduStepicConnector {
   @Nullable
   public static StepicWrappers.AuthorWrapper getCurrentUser() {
     try {
-      return getFromStepic("stepics/1", StepicWrappers.AuthorWrapper.class);
+      return getFromStepic(EduStepicNames.CURRENT_USER, StepicWrappers.AuthorWrapper.class);
     }
     catch (IOException e) {
       LOG.warn("Couldn't get author info");
@@ -88,7 +87,7 @@ public class EduStepicConnector {
   }
 
   public static boolean createUser(@NotNull final String user, @NotNull final String password) {
-    final HttpPost userRequest = new HttpPost(stepicApiUrl + "users");
+    final HttpPost userRequest = new HttpPost(EduStepicNames.STEPIC_API_URL + EduStepicNames.USERS);
     initializeClient();
     setHeaders(userRequest, "application/json");
     String requestBody = new Gson().toJson(new StepicWrappers.UserWrapper(user, password));
@@ -112,9 +111,9 @@ public class EduStepicConnector {
 
   public static void initializeClient() {
     if (ourClient == null) {
-      final HttpGet request = new HttpGet(stepicUrl);
-      request.addHeader(new BasicHeader("referer", "https://stepic.org"));
-      request.addHeader(new BasicHeader("content-type", "application/json"));
+      final HttpGet request = new HttpGet(EduStepicNames.STEPIC_URL);
+      request.addHeader(new BasicHeader("referer", EduStepicNames.STEPIC_URL));
+      request.addHeader(new BasicHeader("content-type", EduStepicNames.CONTENT_TYPE_APPL_JSON));
 
 
       HttpClientBuilder builder =
@@ -165,7 +164,7 @@ public class EduStepicConnector {
   }
 
   private static boolean postCredentials(String user, String password) {
-    String url = stepicUrl + "accounts/login/";
+    String url = EduStepicNames.STEPIC_URL + EduStepicNames.LOGIN;
     final HttpPost request = new HttpPost(url);
     List <NameValuePair> nvps = new ArrayList <NameValuePair>();
     nvps.add(new BasicNameValuePair("csrfmiddlewaretoken", ourCSRFToken));
@@ -200,7 +199,7 @@ public class EduStepicConnector {
   }
 
   static <T> T getFromStepic(String link, final Class<T> container) throws IOException {
-    final HttpGet request = new HttpGet(stepicApiUrl + link);
+    final HttpGet request = new HttpGet(EduStepicNames.STEPIC_API_URL + link);
     if (ourClient == null) {
       initializeClient();
     }
@@ -243,7 +242,7 @@ public class EduStepicConnector {
   }
 
   private static boolean addCoursesFromStepic(List<CourseInfo> result, int pageNumber) throws IOException {
-    final String url = pageNumber == 0 ? "courses" : "courses?page=" + String.valueOf(pageNumber);
+    final String url = pageNumber == 0 ? EduStepicNames.COURSES : EduStepicNames.COURSES_FROM_PAGE + String.valueOf(pageNumber);
     final StepicWrappers.CoursesContainer coursesContainer = getFromStepic(url, StepicWrappers.CoursesContainer.class);
     final List<CourseInfo> courseInfos = coursesContainer.courses;
     for (CourseInfo info : courseInfos) {
@@ -253,7 +252,7 @@ public class EduStepicConnector {
       // TODO: should adaptive course be of PyCharmType ?
       if (info.isAdaptive() || (typeLanguage.size() == 2 && PYCHARM_PREFIX.equals(typeLanguage.get(0)))) {
         for (Integer instructor : info.instructors) {
-          final StepicUser author = getFromStepic("users/" + String.valueOf(instructor), StepicWrappers.AuthorWrapper.class).users.get(0);
+          final StepicUser author = getFromStepic(EduStepicNames.USERS + "/" + String.valueOf(instructor), StepicWrappers.AuthorWrapper.class).users.get(0);
           info.addAuthor(author);
         }
 
@@ -303,15 +302,15 @@ public class EduStepicConnector {
 
   public static List<Lesson> getLessons(int sectionId) throws IOException {
     final StepicWrappers.SectionContainer
-      sectionContainer = getFromStepic("sections/" + String.valueOf(sectionId), StepicWrappers.SectionContainer.class);
+      sectionContainer = getFromStepic(EduStepicNames.SECTIONS + String.valueOf(sectionId), StepicWrappers.SectionContainer.class);
     List<Integer> unitIds = sectionContainer.sections.get(0).units;
     final List<Lesson> lessons = new ArrayList<Lesson>();
     for (Integer unitId : unitIds) {
       StepicWrappers.UnitContainer
-        unit = getFromStepic("units/" + String.valueOf(unitId), StepicWrappers.UnitContainer.class);
+        unit = getFromStepic(EduStepicNames.UNITS + "/" + String.valueOf(unitId), StepicWrappers.UnitContainer.class);
       int lessonID = unit.units.get(0).lesson;
       StepicWrappers.LessonContainer
-        lesson = getFromStepic("lessons/" + String.valueOf(lessonID), StepicWrappers.LessonContainer.class);
+        lesson = getFromStepic(EduStepicNames.LESSONS + String.valueOf(lessonID), StepicWrappers.LessonContainer.class);
       Lesson realLesson = lesson.lessons.get(0);
       realLesson.taskList = new ArrayList<Task>();
       for (Integer s : realLesson.steps) {
@@ -345,7 +344,7 @@ public class EduStepicConnector {
   }
 
   public static StepicWrappers.Step getStep(Integer step) throws IOException {
-    return getFromStepic("steps/" + String.valueOf(step), StepicWrappers.StepContainer.class).steps.get(0).block;
+    return getFromStepic(EduStepicNames.STEPS + "/" + String.valueOf(step), StepicWrappers.StepContainer.class).steps.get(0).block;
   }
 
 
@@ -372,7 +371,7 @@ public class EduStepicConnector {
       }
     }
 
-    final HttpPost attemptRequest = new HttpPost(stepicApiUrl + "attempts");
+    final HttpPost attemptRequest = new HttpPost(EduStepicNames.STEPIC_API_URL + EduStepicNames.ATTEMPTS);
     setHeaders(attemptRequest, "application/json");
     String attemptRequestBody = new Gson().toJson(new StepicWrappers.AttemptWrapper(task.getStepicId()));
     attemptRequest.setEntity(new StringEntity(attemptRequestBody, ContentType.APPLICATION_JSON));
@@ -400,8 +399,8 @@ public class EduStepicConnector {
   }
 
   private static void postSubmission(boolean passed, StepicWrappers.AttemptWrapper.Attempt attempt, ArrayList<StepicWrappers.SolutionFile> files) throws IOException {
-    final HttpPost request = new HttpPost(stepicApiUrl + "submissions");
-    setHeaders(request, "application/json");
+    final HttpPost request = new HttpPost(EduStepicNames.STEPIC_API_URL + EduStepicNames.SUBMISSIONS);
+    setHeaders(request, EduStepicNames.CONTENT_TYPE_APPL_JSON);
 
     String requestBody = new Gson().toJson(new StepicWrappers.SubmissionWrapper(attempt.id, passed ? "1" : "0", files));
     request.setEntity(new StringEntity(requestBody, ContentType.APPLICATION_JSON));
@@ -429,7 +428,7 @@ public class EduStepicConnector {
 
   private static void postCourse(final Project project, @NotNull Course course, boolean relogin, @NotNull final ProgressIndicator indicator) {
     indicator.setText("Uploading course to " + stepicUrl);
-    final HttpPost request = new HttpPost(stepicApiUrl + "courses");
+    final HttpPost request = new HttpPost(EduStepicNames.STEPIC_API_URL + "courses");
     if (ourClient == null || !relogin) {
       if (!login(project)) return;
     }
@@ -438,7 +437,7 @@ public class EduStepicConnector {
       course.setAuthors(user.users);
     }
 
-    setHeaders(request, "application/json");
+    setHeaders(request, EduStepicNames.CONTENT_TYPE_APPL_JSON);
     String requestBody = new Gson().toJson(new StepicWrappers.CourseWrapper(course));
     request.setEntity(new StringEntity(requestBody, ContentType.APPLICATION_JSON));
 
@@ -528,8 +527,8 @@ public class EduStepicConnector {
   }
 
   private static void postUnit(int lessonId, int position, int sectionId) {
-    final HttpPost request = new HttpPost(stepicApiUrl + "units");
-    setHeaders(request, "application/json");
+    final HttpPost request = new HttpPost(EduStepicNames.STEPIC_API_URL + EduStepicNames.UNITS);
+    setHeaders(request, EduStepicNames.CONTENT_TYPE_APPL_JSON);
     final StepicWrappers.UnitWrapper unitWrapper = new StepicWrappers.UnitWrapper();
     unitWrapper.unit = new StepicWrappers.Unit();
     unitWrapper.unit.lesson = lessonId;
@@ -554,7 +553,7 @@ public class EduStepicConnector {
   }
 
   private static int postModule(int courseId, int position, @NotNull final String title) {
-    final HttpPost request = new HttpPost(stepicApiUrl + "sections");
+    final HttpPost request = new HttpPost(EduStepicNames.STEPIC_API_URL + "sections");
     setHeaders(request, "application/json");
     final StepicWrappers.Section section = new StepicWrappers.Section();
     section.course = courseId;
@@ -584,7 +583,7 @@ public class EduStepicConnector {
   }
 
   public static int updateLesson(@NotNull final Project project, @NotNull final Lesson lesson, ProgressIndicator indicator) {
-    final HttpPut request = new HttpPut(stepicApiUrl + "lessons/" + String.valueOf(lesson.id));
+    final HttpPut request = new HttpPut(EduStepicNames.STEPIC_API_URL + EduStepicNames.LESSONS + String.valueOf(lesson.id));
     if (ourClient == null) {
       if (!login(project)) {
         LOG.error("Failed to push lesson");
@@ -623,7 +622,7 @@ public class EduStepicConnector {
   }
 
   public static int postLesson(@NotNull final Project project, @NotNull final Lesson lesson, ProgressIndicator indicator) {
-    final HttpPost request = new HttpPost(stepicApiUrl + "lessons");
+    final HttpPost request = new HttpPost(EduStepicNames.STEPIC_API_URL + EduStepicNames.LESSONS);
     if (ourClient == null) {
       login(project);
     }
@@ -656,7 +655,7 @@ public class EduStepicConnector {
   }
 
   public static void deleteTask(@NotNull final Integer task) {
-    final HttpDelete request = new HttpDelete(stepicApiUrl + "step-sources/" + task);
+    final HttpDelete request = new HttpDelete(EduStepicNames.STEPIC_API_URL + EduStepicNames.STEP_SOURCES + task);
     setHeaders(request, "application/json");
     ApplicationManager.getApplication().invokeLater(() -> {
       try {
@@ -675,7 +674,7 @@ public class EduStepicConnector {
   }
 
   public static void postTask(final Project project, @NotNull final Task task, final int lessonId) {
-    final HttpPost request = new HttpPost(stepicApiUrl + "step-sources");
+    final HttpPost request = new HttpPost(EduStepicNames.STEPIC_API_URL + EduStepicNames.STEP_SOURCES);
     setHeaders(request, "application/json");
     final Gson gson = new GsonBuilder().setPrettyPrinting().excludeFieldsWithoutExposeAnnotation().create();
     ApplicationManager.getApplication().invokeLater(() -> {
diff --git a/python/educational-core/student/src/com/jetbrains/edu/learning/stepic/EduStepicNames.java b/python/educational-core/student/src/com/jetbrains/edu/learning/stepic/EduStepicNames.java
new file mode 100644 (file)
index 0000000..f8e93fd
--- /dev/null
@@ -0,0 +1,24 @@
+package com.jetbrains.edu.learning.stepic;
+
+public class EduStepicNames {
+  static final String STEPIC_URL = "https://stepic.org";
+  static final String STEPIC_API_URL = STEPIC_URL + "/api";
+  static final String RECOMMENDATIONS_URL = "/recommendations";
+  static final String CONTENT_TYPE_APPL_JSON = "application/json";
+  static final String LESSONS = "/lessons/";
+  static final String RECOMMENDATION_REACTIONS_URL = "/recommendation-reactions";
+  static final String ATTEMPTS = "/attempts";
+  static final String SUBMISSIONS = "/submissions";
+  static final String ASSIGNMENT = "/assignments";
+  static final String VIEWS_URL = "/views";
+  static final String UNITS = "/units";
+  static final String DEFAULT_TASKFILE_NAME = "code.py";
+  static final String USERS = "/users";
+  static final String LOGIN = "/accounts/login/";
+  static final String STEP_SOURCES = "/step-sources/";
+  static final String CURRENT_USER = "/stepics/1";
+  static final String COURSES = "/courses";
+  static final String COURSES_FROM_PAGE = COURSES + "?page=";
+  public static final String STEPS = "/steps";
+  static final String SECTIONS = "/sections/";
+}
index 60e91394b8ab251ab30db2d704b6cb0568b1931d..16bbdf9f218be85ae68c7ee24d32ff2f55592bbc 100644 (file)
@@ -103,7 +103,8 @@ public class PyStudyCheckAction extends StudyCheckAction {
               myTaskManger.setStatus(taskFile, StudyStatus.Failed);
               continue;
             }
-            if (EduNames.STUDY.equals(myTaskManger.getCourse().getCourseMode())) {
+            final Course course = myTaskManger.getCourse();
+            if (course != null && EduNames.STUDY.equals(course.getCourseMode())) {
               CommandProcessor.getInstance().runUndoTransparentAction(() -> ApplicationManager.getApplication().runWriteAction(() -> {
                 StudyCheckUtils.runSmartTestProcess(myTaskDir, testRunner, name, taskFile, project);
               }));