Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ public static ChildProblem createEmptyChildProblem() {
}

public void validateAnswerByType(String answer, AnswerType answerType) {
if (this.answerType == AnswerType.MULTIPLE_CHOICE) {
if (answerType == AnswerType.MULTIPLE_CHOICE) {
if (!answer.matches("^[1-5]*$")) {
throw new InvalidValueException(ErrorCode.INVALID_MULTIPLE_CHOICE_ANSWER);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -89,10 +89,10 @@ public Problem(List<ChildProblem> childProblems, boolean isConfirmed, AnswerType
List<String> prescriptionImageUrls, String seniorTipImageUrl, String readingTipImageUrl,
String mainAnalysisImageUrl, String mainProblemImageUrl, String memo, String answer, String title,
ProblemType problemType, int number, PracticeTestTag practiceTestTag,
ProblemCustomId problemCustomId, Integer recommendedMinute, Integer recommendedSecond) {
ProblemCustomId problemCustomId) {
this.childProblems = childProblems;
this.isConfirmed = isConfirmed;
this.answerType = answerType;
this.answerType = AnswerType.SHORT_ANSWER;
this.conceptTagIds = conceptTagIds;
this.mainHandwritingExplanationImageUrl = mainHandwritingExplanationImageUrl;
this.prescriptionImageUrls = prescriptionImageUrls;
Expand All @@ -102,17 +102,17 @@ public Problem(List<ChildProblem> childProblems, boolean isConfirmed, AnswerType
this.mainProblemImageUrl = mainProblemImageUrl;
this.difficulty = new Difficulty(difficulty);
this.memo = memo;
this.answer = new Answer(answer, this.answerType);
this.answer = new Answer("0", this.answerType);
this.title = new Title(title);
this.problemType = problemType;
this.number = number;
this.practiceTestId = practiceTestTag != null ? practiceTestTag.getId() : null;
this.problemCustomId = problemCustomId;
this.recommendedTime = new RecommendedTime(recommendedMinute, recommendedSecond);
this.recommendedTime = new RecommendedTime(0, 0);
}

public String getAnswer() {
return answer.getValue();
return this.answer != null ? answer.getValue() : null;
}

public void update(Problem inputProblem) {
Expand All @@ -133,8 +133,8 @@ public void update(Problem inputProblem) {
this.prescriptionImageUrls = inputProblem.getPrescriptionImageUrls();
this.answerType = inputProblem.getAnswerType();
this.recommendedTime = new RecommendedTime(
inputProblem.getRecommendedTime() != null ? inputProblem.getRecommendedTime().getMinute() : null,
inputProblem.getRecommendedTime() != null ? inputProblem.getRecommendedTime().getSecond() : null
inputProblem.getRecommendedTime().getMinute(),
inputProblem.getRecommendedTime().getSecond()
);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ public class RecommendedTime {

public RecommendedTime(Integer minute, Integer second) {
validateTime(minute, second);
this.minute = minute;
this.second = second;
this.minute = minute != null ? minute : 0;
this.second = second != null ? second : 0;
}

private void validateTime(Integer minute, Integer second) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ public class StringListConverter implements AttributeConverter<List<String>, Str
public String convertToDatabaseColumn(List<String> attribute) {
try {
if (attribute == null || attribute.isEmpty()) {
return "";
return "[]";
}
return attribute.stream()
.filter(str -> str != null && !str.isEmpty())
Expand Down
Loading