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

[BE] 체크리스트 카테고리별 질문 비교 기능을 구현한다. #963

Open
wants to merge 9 commits into
base: dev-be
Choose a base branch
from

Conversation

JINU-CHANG
Copy link
Contributor

@JINU-CHANG JINU-CHANG commented Nov 16, 2024

❗ Issue

✨ 구현한 기능

해당 커밋으로 확인해주세요

  • 체크리스트와 카테고리로 질문 조회하는 메서드 구현
  • 체크리스트 질문을 답변별로 그룹핑
  • 컨트롤러 메서드 구현

📢 논의하고 싶은 내용

🎸 기타

Copy link
Contributor

@tsulocalize tsulocalize 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 +150 to +151
Assertions.assertThat(good.get(0).getQuestionId()).isEqualTo(checklist1Question2Good.getQuestionId());
Assertions.assertThat(bad).hasSize(1);
Copy link
Contributor

Choose a reason for hiding this comment

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

static import를 쓰면 가독성이 올라갈 것 같네요!

Copy link
Contributor Author

Choose a reason for hiding this comment

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

반영했습니다!

private List<QuestionResponse> categorizeQuestionsByAnswer(ChecklistQuestions checklistQuestions, Answer answer) {
return checklistQuestions.filterByAnswer(answer)
.stream()
.map(checklistQuestion -> new QuestionResponse(checklistQuestion.getQuestion(), questionService.readHighlights(checklistQuestion.getQuestionId())))
Copy link
Contributor

Choose a reason for hiding this comment

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

Highlight가 비교 페이지에서 꼭 필요하지 않다면 가져오지 않는 방향으로 가는 게 더 좋아보이긴 합니다!

Copy link
Contributor

@tkdgur0906 tkdgur0906 left a comment

Choose a reason for hiding this comment

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

고생하셨습니다! 리뷰 남겼는데 한번 확인 부탁드려요!

궁금한게 있는데, 저희가 카테고리의 질문과 답변을 답변 기준으로 나눠서 보내면, 이 데이터를 그대로 보여주기 위한 api인가요 아니면 프론트에서 추가작업을 하는 건가요?

Comment on lines +65 to +67
public boolean hasAnswer(Answer answer) {
return this.answer.equals(answer);
}
Copy link
Contributor

@tkdgur0906 tkdgur0906 Nov 16, 2024

Choose a reason for hiding this comment

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

hasAnswer라는 메서드 명이 그냥 Answer를 가지고 있는지 여부를 반환하는 의미로 해석될 수도 있을 것 같아요!
matchesAnswer나 다른 함수명을 고려해보는 것은 어떤가요?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

matchAnswer로 변경했습니다!


import java.util.List;

public record ComparisonCategoryChecklistQuestionResponse(List<QuestionResponse> good,
Copy link
Contributor

Choose a reason for hiding this comment

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

dto이름이 한눈에 와닿지 않는 것 같은데, 가지고 있는 데이터를 이름에 담는 방향은 어떻게 생각하시나요?

AnswerCategorizedQuestionsResponse 이런 느낌으로 생각해봤는데 정확하게 어떤게 좋을지는 잘 모르겠네요🤔

Comment on lines +149 to +153
Assertions.assertThat(good).hasSize(1);
Assertions.assertThat(good.get(0).getQuestionId()).isEqualTo(checklist1Question2Good.getQuestionId());
Assertions.assertThat(bad).hasSize(1);
Assertions.assertThat(bad.get(0).getQuestionId()).isEqualTo(checklist1Question1Bad.getQuestionId());
Assertions.assertThat(none).isEmpty();
Copy link
Contributor

Choose a reason for hiding this comment

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

assertAll로 묶는 건 어떤가요!?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

반영했습니다!

Copy link
Contributor

@shin-jisong shin-jisong left a comment

Choose a reason for hiding this comment

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

딱히 큰 피드백은 없네요!
수고하셨습니다~

@@ -34,6 +36,13 @@ public ResponseEntity<CategoryCustomChecklistQuestionsResponse> readAllCustomChe
return ResponseEntity.ok(questionManageService.readAllCustomChecklistQuestions(user));
}

@GetMapping("/v1/comparison/checklists/{checklistId}/categories/{categoryId}/questions")
Copy link
Contributor

Choose a reason for hiding this comment

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

queryString으로 설계하지 않고 계층적으로 설계하신 이유가 궁금해요!
계층적 설계가 들어가서 checklists가 먼저 나오니 QuestionController에 위치한 게 어색하다는 생각도 들어서요~

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: No status
Development

Successfully merging this pull request may close these issues.

4 participants