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

Feature/1474 키워드의 퀴즈 목록을 조회할 때 각 퀴즈 별로 학습 여부를 알 수 있다 #1509

Conversation

amaran-th
Copy link
Contributor

@amaran-th amaran-th commented Aug 16, 2023

#️⃣연관된 이슈

#1474

📝작업 내용

퀴즈 응답 DTO에 학습 여부 정보를 Boolean 값으로 추가했습니다.
학습 여부는 퀴즈에 대해 답변 게시글을 작성한 경우 true가 됩니다.

@amaran-th amaran-th added BE 로드맵 로드맵 스쿼드 관련 이슈 labels Aug 16, 2023
@amaran-th amaran-th added this to the 2023 레벨3 milestone Aug 16, 2023
@amaran-th amaran-th self-assigned this Aug 16, 2023
Copy link
Contributor

@java-saeng java-saeng left a 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) {
Copy link
Contributor

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 ")
Copy link
Contributor

Choose a reason for hiding this comment

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

끝 부분이라 상관없을 수 있는데 SQL 문에서 띄어쓰기도 중요한 것 같아서 마지막 띄어쓰기는 삭제해주시는게 어떨까요?

amaran-th added 2 commits August 16, 2023 17:17
- 하나의 인자를 가지고 있는 정적 팩토리 메서드의 이름을 from으로 변경

#1474
Copy link
Contributor

@nuyh99 nuyh99 left a 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) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
if (memberId == null) {
if (isNull(memberId)) {

개인 취향이지만 Objects의 정적 메서드를 쓰면 예쁠 것 같아요!

Copy link
Contributor Author

Choose a reason for hiding this comment

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

반영했습니다~

Comment on lines 50 to 51
return essayAnswerRepository.existsByQuizIdAndMemberId(quizId,
memberId);
Copy link
Contributor

Choose a reason for hiding this comment

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

개행 안해도 좋을 것 같다고 생각합니다!

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

@BGuga BGuga left a 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()))
Copy link
Contributor

Choose a reason for hiding this comment

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

BDDMockito.given() 을 사용하는 것은 어떨까요??

Copy link
Contributor Author

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) {
Copy link
Contributor

Choose a reason for hiding this comment

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

정적 팩터리 메서드에서 추가적인 작업이 없으면 new QuizzesResponse() 로 가도 좋지 않을까요??

Copy link
Contributor Author

Choose a reason for hiding this comment

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

반영했습니다~!

@sonarcloud
Copy link

sonarcloud bot commented Sep 8, 2023

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

85.2% 85.2% Coverage
0.0% 0.0% Duplication

warning 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.
Read more here

@amaran-th amaran-th merged commit ab461a9 into roadmap-develop Sep 8, 2023
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
BE 로드맵 로드맵 스쿼드 관련 이슈
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants