Skip to content

Commit

Permalink
fix import export
Browse files Browse the repository at this point in the history
  • Loading branch information
barais committed Oct 23, 2024
1 parent 3046100 commit c151efa
Showing 1 changed file with 29 additions and 0 deletions.
29 changes: 29 additions & 0 deletions src/main/java/fr/istic/service/ImportExportService.java
Original file line number Diff line number Diff line change
Expand Up @@ -245,6 +245,12 @@ public JsonObject export(long courseId, boolean includeStudentData, long eid) {
questionJ.addProperty("libelle", question.libelle);
questionJ.addProperty("gradeType", question.gradeType.name());
questionJ.addProperty("type", question.type.algoName);
questionJ.addProperty("randomHorizontalCorrection", question.randomHorizontalCorrection);
questionJ.addProperty("canExceedTheMax", question.canExceedTheMax);
questionJ.addProperty("canBeNegative", question.canBeNegative);
questionJ.addProperty("mustBeIgnoreInGlobalScale", question.mustBeIgnoreInGlobalScale);


if (question.zone != null) {

Zone zone = Zone.findById(question.zone.id);
Expand Down Expand Up @@ -1008,6 +1014,29 @@ public Course importCourse(JsonObject _course, User user, boolean includeStudent
.findQuestionTypebyAlgoName(gr.getAsJsonObject().get("type").getAsString())
.firstResult();
}
if (gr.getAsJsonObject().get("randomHorizontalCorrection") != null) {
question.randomHorizontalCorrection = gr.getAsJsonObject().get("randomHorizontalCorrection").getAsBoolean();
} else {
question.randomHorizontalCorrection =false;
}
if (gr.getAsJsonObject().get("canExceedTheMax") != null) {
question.canExceedTheMax = gr.getAsJsonObject().get("canExceedTheMax").getAsBoolean();
} else {
question.canExceedTheMax =false;
}
if (gr.getAsJsonObject().get("canBeNegative") != null) {
question.canBeNegative = gr.getAsJsonObject().get("canBeNegative").getAsBoolean();
} else {
question.canBeNegative =false;
}
if (gr.getAsJsonObject().get("mustBeIgnoreInGlobalScale") != null) {
question.mustBeIgnoreInGlobalScale = gr.getAsJsonObject().get("mustBeIgnoreInGlobalScale").getAsBoolean();
} else {
question.mustBeIgnoreInGlobalScale =false;
}



question.persistAndFlush();
uuidId.put(gr.getAsJsonObject().get("uuid").getAsString(), question.id);
});
Expand Down

0 comments on commit c151efa

Please sign in to comment.