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

Latest Reviews #15

Closed
Ace000001 opened this issue Jul 25, 2020 · 5 comments
Closed

Latest Reviews #15

Ace000001 opened this issue Jul 25, 2020 · 5 comments

Comments

@Ace000001
Copy link

Hi There!

Awesome work putting up a basic request and html setup! But i noticed one thing when i try to use it in my project. The data you get in the response is the top 5 most relevant reviews instead of latest reviews. Is there a way to tell the API to get the latest review instead of most relevant reviews?

Cheers

@Ace000001
Copy link
Author

Ace000001 commented Jul 25, 2020

Also i made a little modification to your source code. Its nice to allow callbacks once you are done rendering the reviews in case if we want to initialize other plugins or such. Consider committing the following code if you like x)

$.fn.googlePlaces = function(options, userCallback) {
...
   var callback = function(place, status) {
      if (status == google.maps.places.PlacesServiceStatus.OK) {
        var filteredReviews = filterReviewsByMinRating(place.reviews);
        var sortedReviews = sortReviewsByDateDesc(filteredReviews);
        if (sortedReviews.length > 0) {
          renderHeader(settings.header);
          renderReviews(sortedReviews);
          renderFooter(settings.footer);
          //custom callback added
          userCallback();
        }
      }
    }
...
}

Hope it help others!

@simonneutert
Copy link
Owner

@Ace000001
Copy link
Author

My issue is not the number of reviews but the order in which we get those reviews. let me explain: Lets suppose i have total 10 reviews on google. I want to get reviews 1 to 5 being latest. But what i get is something like 10, 2, 4, 8, 1, being most relevant. So the issue here is the sort order in which google send us the reviews by default. Which is not 'Latest' but most 'Relevant'.

@simonneutert
Copy link
Owner

https://stackoverflow.com/questions/39223719/to-get-more-than-5-reviews-from-google-places-api

see here, please, and get back in touch after reading @Ace000001

@simonneutert
Copy link
Owner

@Ace000001 all reviews are kept to the owner as it looks like:

https://developers.google.com/my-business/content/review-data#list_all_reviews

you could retrieve them daily and then serve them over a simple api server, but this busts the scope of this project, i am sorry

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants