mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
Fix problems with checking local courses after fixes with flush adaptive courses
This commit is contained in:
+4
-4
@@ -90,14 +90,14 @@ public class StudyProjectGenerator {
|
||||
protected Course getCourse(@NotNull final Project project) {
|
||||
final File courseFile = new File(new File(OUR_COURSES_DIR, mySelectedCourseInfo.getName()), EduNames.COURSE_META_FILE);
|
||||
if (courseFile.exists()) {
|
||||
return readCourseFromCache(courseFile);
|
||||
return readCourseFromCache(courseFile, false);
|
||||
}
|
||||
else {
|
||||
final File adaptiveCourseFile = new File(new File(OUR_COURSES_DIR, ADAPTIVE_COURSE_PREFIX +
|
||||
mySelectedCourseInfo.getName() + "_" +
|
||||
myUser.getEmail()), EduNames.COURSE_META_FILE);
|
||||
if (adaptiveCourseFile.exists()) {
|
||||
return readCourseFromCache(adaptiveCourseFile);
|
||||
return readCourseFromCache(adaptiveCourseFile, true);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -110,13 +110,13 @@ public class StudyProjectGenerator {
|
||||
}
|
||||
|
||||
@Nullable
|
||||
private static Course readCourseFromCache(File courseFile) {
|
||||
private static Course readCourseFromCache(@NotNull File courseFile, boolean isAdaptive) {
|
||||
Reader reader = null;
|
||||
try {
|
||||
reader = new InputStreamReader(new FileInputStream(courseFile), "UTF-8");
|
||||
Gson gson = new GsonBuilder().create();
|
||||
final Course course = gson.fromJson(reader, Course.class);
|
||||
course.initCourse(true);
|
||||
course.initCourse(isAdaptive);
|
||||
return course;
|
||||
}
|
||||
catch (UnsupportedEncodingException e) {
|
||||
|
||||
@@ -218,7 +218,7 @@ def check_samples(samples=()):
|
||||
passed()
|
||||
|
||||
|
||||
def run_common_tests():
|
||||
def run_common_tests(error_text="Please, reload file and try again"):
|
||||
test_is_initial_text()
|
||||
test_is_not_empty()
|
||||
test_answer_placeholders_text_deleted()
|
||||
|
||||
Reference in New Issue
Block a user