Skip to content

Commit

Permalink
[FIX] 새로고침 할 수 있는 일일문답 필드 정리 #123
Browse files Browse the repository at this point in the history
  • Loading branch information
ddongseop committed Apr 3, 2024
1 parent 3afd9fc commit e7e0eec
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
import com.fasterxml.jackson.databind.annotation.JsonNaming;
import lombok.Builder;
import lombok.Getter;
import sopt.org.umbba.domain.domain.qna.QnA;
import sopt.org.umbba.domain.domain.qna.Question;

@Getter
Expand All @@ -13,18 +12,20 @@
public class RerollCheckResponseDto {

private Long questionId;
private String childQuestion;
private String parentQuestion;
private String section;
private String topic;
private String newQuestion;

public static RerollCheckResponseDto of(boolean isMeChild, Question question) {

String newQuestion;
if (isMeChild) {
newQuestion = question.getChildQuestion();
} else {
newQuestion = question.getParentQuestion();
}

public static RerollCheckResponseDto of(Question question) {
return RerollCheckResponseDto.builder()
.questionId(question.getId())
.childQuestion(question.getChildQuestion())
.parentQuestion(question.getParentQuestion())
.section(question.getSection().getValue())
.topic(question.getTopic())
.newQuestion(newQuestion)
.build();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -542,7 +542,7 @@ public RerollCheckResponseDto rerollCheck(Long userId) {
randomQuestion = differentSectionQuestions.get(random.nextInt(differentSectionQuestions.size()));
}

return RerollCheckResponseDto.of(randomQuestion);
return RerollCheckResponseDto.of(user.isMeChild(), randomQuestion);
}

@Transactional
Expand Down

0 comments on commit e7e0eec

Please sign in to comment.