use last subtask index instead of subtask number
[idea/community.git] / python / educational-core / course-creator / src / com / jetbrains / edu / coursecreator / actions / CCNewSubtaskAction.java
index d3ed834259650420449137f85115cd8d9d9ec02e..11581f3d8830b75b0131d69afd8b41feda0581b8 100644 (file)
@@ -54,15 +54,15 @@ public class CCNewSubtaskAction extends DumbAwareAction {
     if (taskFile == null) {
       return;
     }
-    VirtualFile taskDir = StudyUtils.getTaskDir(virtualFile);
+    Task task = taskFile.getTask();
+    VirtualFile taskDir = task.getTaskDir(project);
     if (taskDir == null) {
       return;
     }
-    Task task = taskFile.getTask();
     createTestsForNewSubtask(project, task);
-    int num = task.getSubtaskNum();
+    int num = task.getLastSubtaskIndex() + 1;
     createTaskDescriptionFile(project, taskDir, num);
-    task.setSubtaskNum(num + 1);
+    task.setLastSubtaskIndex(num);
     StudySubtaskUtils.switchStep(project, task, num);
   }