mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
Do not save empty choice parameters for non-choice tasks
This commit is contained in:
+8
-2
@@ -44,7 +44,7 @@ public class Task implements StudyItem {
|
||||
@Transient private Lesson myLesson;
|
||||
@Expose @SerializedName("update_date") private Date myUpdateDate;
|
||||
|
||||
@Expose @SerializedName("choice_parameters") private ChoiceParameters myChoiceParameters = new ChoiceParameters();
|
||||
@Expose @SerializedName("choice_parameters") private ChoiceParameters myChoiceParameters;
|
||||
private int myActiveSubtaskIndex = 0;
|
||||
@SerializedName("last_subtask_index")
|
||||
@Expose private int myLastSubtaskIndex = 0;
|
||||
@@ -54,6 +54,12 @@ public class Task implements StudyItem {
|
||||
public Task(@NotNull final String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public static Task createChoiceTask(@NotNull String name) {
|
||||
final Task task = new Task(name);
|
||||
task.setChoiceParameters(new ChoiceParameters());
|
||||
return task;
|
||||
}
|
||||
|
||||
/**
|
||||
* Initializes state of task file
|
||||
@@ -326,7 +332,7 @@ public class Task implements StudyItem {
|
||||
}
|
||||
|
||||
public boolean isChoiceTask() {
|
||||
return !myChoiceParameters.getChoiceVariants().isEmpty();
|
||||
return myChoiceParameters != null;
|
||||
}
|
||||
|
||||
// used for serialization
|
||||
|
||||
+1
-1
@@ -156,7 +156,7 @@ public class EduAdaptiveStepicConnector {
|
||||
@NotNull String lessonName,
|
||||
@NotNull StepicWrappers.Step block,
|
||||
int stepId) {
|
||||
final Task task = new Task(lessonName);
|
||||
final Task task = Task.createChoiceTask(lessonName);
|
||||
task.setStepId(stepId);
|
||||
task.setText(block.text);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user