use last subtask index instead of subtask number
[idea/community.git] / python / educational-core / student / src / com / jetbrains / edu / learning / checker / StudyCheckTask.java
index b38f438a078dca52f122d385b4799138c0ef08d1..cf054406f5d8f6fbc39324c348251d1bbb17ad0e 100644 (file)
@@ -189,10 +189,12 @@ public class StudyCheckTask extends com.intellij.openapi.progress.Task.Backgroun
           });
       }
       else {
-        boolean hasMoreSubtasks = myTask.hasSubtasks() && myTask.getActiveSubtaskIndex() != myTask.getSubtaskNum() - 1;
+        boolean hasMoreSubtasks = myTask.hasSubtasks() && myTask.getActiveSubtaskIndex() != myTask.getLastSubtaskIndex();
         int visibleSubtaskIndex = myTask.getActiveSubtaskIndex() + 1;
         ApplicationManager.getApplication().invokeLater(() -> {
-          String resultMessage = !hasMoreSubtasks ? message : "Subtask " + visibleSubtaskIndex + "/" + myTask.getSubtaskNum() + " solved";
+          int subtaskSize = myTask.getLastSubtaskIndex() + 1;
+          String resultMessage = !hasMoreSubtasks ? message : "Subtask " + visibleSubtaskIndex + "/" +
+                                                              subtaskSize + " solved";
           StudyCheckUtils.showTestResultPopUp(resultMessage, MessageType.INFO.getPopupBackground(), myProject);
           if (hasMoreSubtasks) {
             int nextSubtaskIndex = myTask.getActiveSubtaskIndex() + 1;