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: 식당 조회시 북마크 수량 조회 기능 #204

Merged
merged 7 commits into from
Jul 4, 2024
Merged

Conversation

Arachneee
Copy link
Contributor

issue: #203

as-is

  • 사용자들이 어떤 음식점을 맛집으로 생각하는지 직관적으로 알기 어려움

to-be

  • 식당을 조회할 때 북마크 수량을 함께 조회

@Arachneee Arachneee self-assigned this Jun 21, 2024
Copy link
Member

@PgmJun PgmJun left a comment

Choose a reason for hiding this comment

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

테스트까지 잘 구현해주셨네요 백호!
소소한 리뷰 남겼으니 확인부탁드려요:)

Copy link
Member

@jinyoungchoi95 jinyoungchoi95 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 345 to 350
for (int i = 1; i <= 3; i++) {
Member member = createTestMember("githubId" + i);
memberRepository.save(member);

bookmarkRepository.save(createTestBookmark(member, restaurant));
}
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
for (int i = 1; i <= 3; i++) {
Member member = createTestMember("githubId" + i);
memberRepository.save(member);
bookmarkRepository.save(createTestBookmark(member, restaurant));
}
Member member1 = memberRepository.save(createTestMember("githubId1"));
bookmarkRepository.save(createTestBookmark(member1, restaurant));
Member member2 = memberRepository.save(createTestMember("githubId2"));
bookmarkRepository.save(createTestBookmark(member2, restaurant));
Member member3 = memberRepository.save(createTestMember("githubId3"));
bookmarkRepository.save(createTestBookmark(member3, restaurant));

가능하면 테스트에는 for와 같은 로직보다는 차라리 하드코딩해서 각 값을 넣어주는 것이 좋을 것 같아요.
물론 로직이 단순할 수도 있지만 1~3이라는 로직자체가들어갔다는 것은 그 구문을 이해해야하는 범위가 늘어나 직관적이지 못하고 간단하더라도 오류를 범할 수 있기 때문이에요.

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
Contributor Author

Choose a reason for hiding this comment

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

3개 정도는 하드코딩으로 넣는 것이 훨씬 직관적으로 보이네요!

@@ -79,7 +80,8 @@ public RestaurantResponse findById(final String githubId, final Long restaurantI
.orElseThrow(RestaurantNotFoundException::new),
reviewRepository.findAverageRatingUsingRestaurantId(restaurantId)
.orElse(0.0),
isBookmarked(githubId, restaurantId));
isBookmarked(githubId, restaurantId),
bookmarkRepository.countByRestaurantId(restaurantId));
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
bookmarkRepository.countByRestaurantId(restaurantId));
bookmarkRepository.countByRestaurantId(restaurantId)
);

Copy link
Contributor

@hyeon0208 hyeon0208 left a comment

Choose a reason for hiding this comment

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

수고하셨습니다 백호 ~! 😃
간단한 의견 남겨봤으니 확인해주시면 감사하겠습니다 😊

@@ -79,7 +80,8 @@ public RestaurantResponse findById(final String githubId, final Long restaurantI
.orElseThrow(RestaurantNotFoundException::new),
reviewRepository.findAverageRatingUsingRestaurantId(restaurantId)
.orElse(0.0),
Copy link
Contributor

Choose a reason for hiding this comment

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

기존에 작성되어 있는 코드 같은데
0.0이라는 값이 직관적으로 다가오지 않다고 느껴져
이를 DEFAULT_RATING 같이 상수로 관리하는 건 어떻게 생각하시나요 ?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

기본 별점이 0.0에서 바뀌는 경우가 없을 것 같고 바로 0.0점을 확인하는 것이 더 직관적일 것 같습니다.
상수로 관리하게 되면 기본값이 0.0이 아닐 수 있나? 라는 생각에 코드 상단으로 다시 올라가야하는 불편함이 있을 것 같습니다.

@Arachneee Arachneee requested a review from jinyoungchoi95 July 1, 2024 03:15
Copy link

sonarqubecloud bot commented Jul 3, 2024

@Arachneee Arachneee merged commit 26a226b into main Jul 4, 2024
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants