get course language from stepic

This commit is contained in:
Liana Bakradze
2015-02-24 15:07:52 +03:00
parent 6b402e0f97
commit 04b7ec03f1
2 changed files with 14 additions and 3 deletions
@@ -15,14 +15,18 @@ public class CourseInfo {
private String myName;
@SerializedName("summary")
private String myDescription;
@SerializedName("course_format")
//course type in format "pycharm <language>"
private String myType;
private String myAuthor;
public static CourseInfo INVALID_COURSE = new CourseInfo("", "", "");
public static CourseInfo INVALID_COURSE = new CourseInfo("", "", "", "");
public CourseInfo(String name, String author, String description) {
public CourseInfo(String name, String author, String description, String type) {
myName = name;
myAuthor = author;
myDescription = description;
myType = type;
}
public String getName() {
@@ -37,6 +41,10 @@ public class CourseInfo {
return myDescription;
}
public String getType() {
return myType;
}
@Override
public String toString() {
return myName;
@@ -41,6 +41,8 @@ public class EduStepicConnector {
private static final String ourDomain = "stepic.org";
private static String ourSessionId = "524iethiwju2tjywaqmf7tbwx0p0jk1b";
private static String ourCSRFToken = "LJ9n6OyLVA7hxU94dlYWUu65MF51Nx37";
//this prefix indicates that course can be opened by educational plugin
public static final String PYCHARM_PREFIX = "pycharm ";
private EduStepicConnector() {
}
@@ -84,7 +86,8 @@ public class EduStepicConnector {
course.setAuthor(info.getAuthor());
course.setDescription(info.getDescription());
course.setName(info.getName());
course.setLanguage("Python"); // TODO: get from stepic
String courseType = info.getType();
course.setLanguage(courseType.substring(PYCHARM_PREFIX.length()));
course.setUpToDate(true); // TODO: get from stepic
try {
for (Integer section : info.sections) {