Remove unused stepic names, add "/" to stepic urls where needed
authorValentina Kiryushkina <valentina.kiryushkina@jetbrains.com>
Mon, 21 Nov 2016 15:39:26 +0000 (18:39 +0300)
committerValentina Kiryushkina <valentina.kiryushkina@jetbrains.com>
Tue, 22 Nov 2016 10:01:41 +0000 (13:01 +0300)
python/educational-core/student/src/com/jetbrains/edu/learning/stepic/EduStepicConnector.java
python/educational-core/student/src/com/jetbrains/edu/learning/stepic/EduStepicNames.java

index bf8792e1ae59fc1942c0df16d7b56b5203b2a9bc..b1ba4950ea44300e360d4054cb268cc48c68f1c5 100644 (file)
@@ -102,7 +102,7 @@ public class EduStepicConnector {
   }
 
   public static Date getTaskUpdateDate(final int taskId) {
   }
 
   public static Date getTaskUpdateDate(final int taskId) {
-    final String url = EduStepicNames.STEPS + "/" + String.valueOf(taskId);
+    final String url = EduStepicNames.STEPS + String.valueOf(taskId);
     try {
       List<StepicWrappers.StepSource> steps = EduStepicClient.getFromStepic(url, StepicWrappers.StepContainer.class).steps;
       if (!steps.isEmpty()) {
     try {
       List<StepicWrappers.StepSource> steps = EduStepicClient.getFromStepic(url, StepicWrappers.StepContainer.class).steps;
       if (!steps.isEmpty()) {
@@ -138,7 +138,7 @@ public class EduStepicConnector {
       if (!info.isAdaptive() && StringUtil.isEmptyOrSpaces(info.getType())) continue;
       if (canBeOpened(info)) {
         for (Integer instructor : info.instructors) {
       if (!info.isAdaptive() && StringUtil.isEmptyOrSpaces(info.getType())) continue;
       if (canBeOpened(info)) {
         for (Integer instructor : info.instructors) {
-          final StepicUser author = EduStepicClient.getFromStepic(EduStepicNames.USERS + "/" + String.valueOf(instructor),
+          final StepicUser author = EduStepicClient.getFromStepic(EduStepicNames.USERS + String.valueOf(instructor), 
                                                                   StepicWrappers.AuthorWrapper.class).users.get(0);
           info.addAuthor(author);
         }
                                                                   StepicWrappers.AuthorWrapper.class).users.get(0);
           info.addAuthor(author);
         }
@@ -273,9 +273,8 @@ public class EduStepicConnector {
   }
 
   public static StepicWrappers.StepSource getStep(@NotNull Project project, int step) throws IOException {
   }
 
   public static StepicWrappers.StepSource getStep(@NotNull Project project, int step) throws IOException {
-    return EduStepicAuthorizedClient.getFromStepic(EduStepicNames.STEPS + "/" + String.valueOf(step), 
-                                                   StepicWrappers.StepContainer.class, project).steps
-      .get(0);
+    return EduStepicAuthorizedClient.getFromStepic(EduStepicNames.STEPS + String.valueOf(step), 
+                                                   StepicWrappers.StepContainer.class, project).steps.get(0);
   }
 
   public static void postAttempt(@NotNull final Task task, boolean passed, @NotNull final Project project) {
   }
 
   public static void postAttempt(@NotNull final Task task, boolean passed, @NotNull final Project project) {
index e4557ca4c23fdfe6d923594f7cdb6591180f1ec8..b25e80fcea34bdcbbfe778ccb1733f359f356f27 100644 (file)
@@ -11,16 +11,13 @@ public class EduStepicNames {
   public static final String RECOMMENDATION_REACTIONS_URL = "/recommendation-reactions";
   public static final String ATTEMPTS = "/attempts";
   public static final String SUBMISSIONS = "/submissions";
   public static final String RECOMMENDATION_REACTIONS_URL = "/recommendation-reactions";
   public static final String ATTEMPTS = "/attempts";
   public static final String SUBMISSIONS = "/submissions";
-  public static final String ASSIGNMENT = "/assignments";
-  public static final String VIEWS_URL = "/views";
   public static final String UNITS = "/units";
   public static final String DEFAULT_TASKFILE_NAME = "code.py";
   public static final String UNITS = "/units";
   public static final String DEFAULT_TASKFILE_NAME = "code.py";
-  public static final String USERS = "/users";
-  public static final String LOGIN = "/accounts/login/";
+  public static final String USERS = "/users/";
   public static final String STEP_SOURCES = "/step-sources/";
   public static final String CURRENT_USER = "/stepics/1";
   public static final String COURSES = "/courses";
   public static final String STEP_SOURCES = "/step-sources/";
   public static final String CURRENT_USER = "/stepics/1";
   public static final String COURSES = "/courses";
-  public static final String STEPS = "/steps";
+  public static final String STEPS = "/steps/";
   public static final String SECTIONS = "/sections/";
   public static final String ENROLLMENTS = "/enrollments";
   public static final String STEPIC_REGISTRATION_LINK = "https://stepic.org/registration?next=%2Fexplore%2Fcourses";
   public static final String SECTIONS = "/sections/";
   public static final String ENROLLMENTS = "/enrollments";
   public static final String STEPIC_REGISTRATION_LINK = "https://stepic.org/registration?next=%2Fexplore%2Fcourses";