Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[FEAT] 온보딩에서 진행한 선택질문에 따라 사용자에게 맞춘 질문 리스트 생성 기능 구현 #39

Merged
merged 5 commits into from
Jul 14, 2023

Conversation

ddongseop
Copy link
Member

📌 관련 이슈

closed #36

✨ 어떤 이유로 변경된 내용인지

  • 온보딩에서 부모, 자식에게 모두 5개의 선택 질문이 주어지며 이에 따라 질문 리스트가 생성됨
  • 온보딩이 끝나는 시점에 사용자에게 맞춘 질문 리스트를 생성하는 기능 필요

🙏 검토 혹은 리뷰어에게 남기고 싶은 말

@ddongseop ddongseop added ddongseop🍑 ✨Feat 새로운 기능 추가 🪄API 서버 API 통신 ☁️Database DB 관련 labels Jul 14, 2023
@ddongseop ddongseop requested a review from jun02160 July 14, 2023 19:30
@ddongseop ddongseop self-assigned this Jul 14, 2023
Copy link
Member

@jun02160 jun02160 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

진짜.. 너무너무 수고하셨습니다..

Comment on lines -36 to +37

private List<OnboardingAnswer> onboardingAnswerList;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

아 이거 각각 변수가 아니라 리스트로 관리했구나 확인했음!!


@Getter
@NoArgsConstructor(access = AccessLevel.PRIVATE)
@JsonNaming(PropertyNamingStrategies.SnakeCaseStrategy.class)
public class OnboardingReceiveRequestDto {

@NotBlank(message = "부모자식 관계 아이디는 필수 입력 값입니다.")
@NonNull
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

이거 @NotNull이 아니라 @nonnull로 해줘도 가능한거지??

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

아 둘다 있구나 근데 어떤거 쓰는게 더 좋을라나

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

실수였어용 NotNull로 변경완!

Comment on lines -33 to -40
@GetMapping("/qna/dummy")
@ResponseStatus(HttpStatus.OK)
public ApiResponse dummy() {
qnAService.createQnA();

return ApiResponse.success(SuccessType.GET_TODAY_QNA_SUCCESS);
}

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

더미 없애준 이유가 실제 필터링 로직으로 바꿔줘서 그런거 맞지??

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

맞앙


YES("응"),
NO("아니"),
SKIP("잘 모르겠어");
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

스킵 이름 너무 좋은데요


List<Question> findBySectionAndGroup(QuestionSection section, QuestionGroup group);

default List<Question> findBySectionAndGroupRandom(QuestionSection section, QuestionGroup group, int size) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

default 키워드의 용도에 대해 처음 알았다!! 또 배워갑니다

Comment on lines +21 to +22
List<Question> matchingQuestions = findBySectionAndGroup(section, group);
List<Question> selectedQuestions = new ArrayList<>();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

온보딩 추가질문에서 분류한 그룹으로 질문 필터링한 거 맞지??? (이해한 내용이 맞는지 그냥 확인..)

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

글고 첨에 질문 7개 리스트를 다 뽑아두고 시작하는 걸 여기서 처리하는거지?

Comment on lines +118 to +121
parentchild.changeChildOnboardingAnswerList(onboardingAnswerList);
} else {
parentchild.changeParentOnboardingAnswerList(onboardingAnswerList);
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

change해야 하는 상황이 구체적으로 어떤 부분을 말하는거야??

Comment on lines +155 to +165
for (Question question : selectedQuestions) {
QnA newQnA = QnA.builder()
.question(question)
.isParentAnswer(false)
.isChildAnswer(false)
.build();
qnARepository.save(newQnA);
parentchild.addQnA(newQnA);
}
}
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

처음에 질문을 필터링해서 Question에 대한 QnA리스트 구성하고 시작하는 거구나! 좋다좋다

Comment on lines +220 to 248
private QuestionGroup selectGroup(List<OnboardingAnswer> childList, List<OnboardingAnswer> parentList) {

// 그룹 선택 알고리즘
if (childList.get(0) == YES && parentList.get(0) == YES) {
return GROUP1;
}
if (childList.get(1) == YES && parentList.get(1) == YES) {
return GROUP2;
}
if (childList.get(2) == YES && parentList.get(2) == YES) {
return GROUP3;
}
if (childList.get(3) == YES && parentList.get(3) == YES) {
return GROUP4;
}
if (childList.get(4) == YES && parentList.get(4) == YES) {
return GROUP5;
}
if (childList.get(5) == YES && parentList.get(5) == YES) {
return GROUP6;
}
return GROUP7;
}

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

이 부분 진짜 ㅋㅋㅋㅋㅋ 수고했다.... 기획 구체화되면 다시 제대로 값 넣어보자

@ddongseop ddongseop force-pushed the feat/#36-make_custom_qna_list branch from 3aa055c to 3801d40 Compare July 14, 2023 20:17
@ddongseop ddongseop merged commit 819745c into develop Jul 14, 2023
1 check passed
@ddongseop ddongseop deleted the feat/#36-make_custom_qna_list branch August 12, 2023 16:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🪄API 서버 API 통신 ☁️Database DB 관련 ddongseop🍑 ✨Feat 새로운 기능 추가
Projects
None yet
2 participants