fix to support subtasks in java
authorliana.bakradze <liana.bakradze@jetbrains.com>
Tue, 18 Oct 2016 10:25:19 +0000 (13:25 +0300)
committerliana.bakradze <liana.bakradze@jetbrains.com>
Thu, 17 Nov 2016 14:08:30 +0000 (17:08 +0300)
python/educational-core/course-creator/src/com/jetbrains/edu/coursecreator/actions/CCNewSubtaskAction.java
python/educational-core/student/src/com/jetbrains/edu/learning/courseFormat/Task.java

index d3ed834259650420449137f85115cd8d9d9ec02e..4e224d258f5e18a0911a2304156a58b4405f67f6 100644 (file)
@@ -54,11 +54,11 @@ public class CCNewSubtaskAction extends DumbAwareAction {
     if (taskFile == null) {
       return;
     }
     if (taskFile == null) {
       return;
     }
-    VirtualFile taskDir = StudyUtils.getTaskDir(virtualFile);
+    Task task = taskFile.getTask();
+    VirtualFile taskDir = task.getTaskDir(project);
     if (taskDir == null) {
       return;
     }
     if (taskDir == null) {
       return;
     }
-    Task task = taskFile.getTask();
     createTestsForNewSubtask(project, task);
     int num = task.getSubtaskNum();
     createTaskDescriptionFile(project, taskDir, num);
     createTestsForNewSubtask(project, task);
     int num = task.getSubtaskNum();
     createTaskDescriptionFile(project, taskDir, num);
index aaa72fe823bee8954693dc59ff3b0cffbd37213e..d16950df17ae6ac27c3330747e9c3d0a6b9e59a2 100644 (file)
@@ -144,7 +144,12 @@ public class Task implements StudyItem {
     if (courseDir != null) {
       VirtualFile lessonDir = courseDir.findChild(lessonDirName);
       if (lessonDir != null) {
     if (courseDir != null) {
       VirtualFile lessonDir = courseDir.findChild(lessonDirName);
       if (lessonDir != null) {
-        return lessonDir.findChild(taskDirName);
+        VirtualFile taskDir = lessonDir.findChild(taskDirName);
+        if (taskDir == null) {
+          return null;
+        }
+        VirtualFile srcDir = taskDir.findChild(EduNames.SRC);
+        return srcDir != null ? srcDir : taskDir;
       }
     }
     return null;
       }
     }
     return null;