mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-10-06 06:21:16 +07:00
get course language from stepic
This commit is contained in:
@@ -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) {
|
||||
|
||||
Reference in New Issue
Block a user