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

Update recommendations ASC 방식으로 개선 #15

Merged
merged 4 commits into from
Nov 1, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions ddl/insert_mock_data.sql
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
USE `dittodining`;

INSERT INTO restaurant(restaurant_id,name,address,description,maximum_price_per_person,minimum_price_per_person,latitude,longitude,business_hours_json,recommendation_score,average_score_from_naver,total_review_count_from_naver,average_score_from_kakao,total_review_count_from_kakao,total_review_count) VALUES (1,'농민백암순대 본점','서울특별시 강남구 선릉로86길 40-4','다코숨은맛집'', ''수요미식회'', ''혼밥'', ''식사모임''',13000,10000,127.0530139,37.5037,'[
{
"dayOfWeek": "DAY_OF_WEEK_SUNDAY",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ func (r *restaurantRecommendationRepository) FindAllByRestaurantRecommendationRe

whereConditions := make([]interface{}, 0)
if cursorRestaurantRecommendationID != nil {
whereConditions = append(whereConditions, "restaurant_recommendation_request_id < ?", *cursorRestaurantRecommendationID)
whereConditions = append(whereConditions, "restaurant_recommendation_id > ?", *cursorRestaurantRecommendationID)
}

limitQuery := 10
Expand All @@ -46,7 +46,7 @@ func (r *restaurantRecommendationRepository) FindAllByRestaurantRecommendationRe
RestaurantRecommendationRequestID: restaurantRecommendationRequestID,
},
whereConditions...).
Order("restaurant_recommendation_request_id DESC").
Order("restaurant_recommendation_id ASC").
Limit(limitQuery).
Find(&recommendations)
if result.Error != nil {
Expand Down