-
Notifications
You must be signed in to change notification settings - Fork 28
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
Feature/1474 키워드의 퀴즈 목록을 조회할 때 각 퀴즈 별로 학습 여부를 알 수 있다 #1509
The head ref may contain hidden characters: "feature/1474-\uD0A4\uC6CC\uB4DC\uC758_\uD034\uC988_\uBAA9\uB85D\uC744_\uC870\uD68C\uD560_\uB54C_\uAC01_\uD034\uC988_\uBCC4\uB85C_\uD559\uC2B5_\uC5EC\uBD80\uB97C_\uC54C_\uC218_\uC788\uB2E4"
Feature/1474 키워드의 퀴즈 목록을 조회할 때 각 퀴즈 별로 학습 여부를 알 수 있다 #1509
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
고생하셨습니다 !
코멘트 답변 남겨주시고 다시 재요청 부탁드려요~
this.question = question; | ||
} | ||
|
||
public static EssayAnswerQuizResponse of(Quiz quiz) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
파라미터 한개일 경우에 정팩매에서 from 으로 사용하는 것으로 알고 있습니다!
무조건은 아니지만 이렇게 많이 쓰더라구요
import org.springframework.data.jpa.repository.JpaSpecificationExecutor; | ||
import wooteco.prolog.roadmap.domain.EssayAnswer; | ||
|
||
public interface EssayAnswerRepository extends JpaRepository<EssayAnswer, Long>, | ||
JpaSpecificationExecutor<EssayAnswer> { | ||
|
||
@Query("select ea from EssayAnswer ea where ea.quiz.id = :quizId and ea.member.id = :memberId ") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
끝 부분이라 상관없을 수 있는데 SQL 문에서 띄어쓰기도 중요한 것 같아서 마지막 띄어쓰기는 삭제해주시는게 어떨까요?
- 하나의 인자를 가지고 있는 정적 팩토리 메서드의 이름을 from으로 변경 #1474
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
간단한 제 취향만 남겨봤습니다!
} | ||
|
||
private boolean isLearning(Long memberId, Long quizId) { | ||
if (memberId == null) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if (memberId == null) { | |
if (isNull(memberId)) { |
개인 취향이지만 Objects의 정적 메서드를 쓰면 예쁠 것 같아요!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
반영했습니다~
return essayAnswerRepository.existsByQuizIdAndMemberId(quizId, | ||
memberId); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
개행 안해도 좋을 것 같다고 생각합니다!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
반영했습니다!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
간단한 커멘트 남겼습니다!!
//given | ||
final long findQuizId = 1L; | ||
final String findQuizQuestion = "question"; | ||
when(essayAnswerRepository.existsByQuizIdAndMemberId(anyLong(), anyLong())) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
BDDMockito.given() 을 사용하는 것은 어떨까요??
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
반영했습니다!
final List<QuizResponse> responses = quizzes.stream().map(QuizResponse::of) | ||
.collect(Collectors.toList()); | ||
return new QuizzesResponse(keywordId, responses); | ||
public static QuizzesResponse of(Long keywordId, List<QuizResponse> quizzes) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
정적 팩터리 메서드에서 추가적인 작업이 없으면 new QuizzesResponse() 로 가도 좋지 않을까요??
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
반영했습니다~!
Kudos, SonarCloud Quality Gate passed! 0 Bugs 85.2% Coverage The version of Java (11.0.20) you have used to run this analysis is deprecated and we will stop accepting it soon. Please update to at least Java 17. |
#️⃣연관된 이슈
#1474
📝작업 내용
퀴즈 응답 DTO에 학습 여부 정보를 Boolean 값으로 추가했습니다.
학습 여부는 퀴즈에 대해 답변 게시글을 작성한 경우 true가 됩니다.