Based on an article: How Not To Sort By Average Rating
This code snippet sorts the restaurant listing in Foodpanda.co.th by using the equation from the above article.
Assumptions: Since the article is for binary rating (+/−), I’m going to make an assumption that the stars represent the proportion of delighted customers. For example, if a restaurant gets 4.5 stars and has 2,000 reviews, it is assumed that there are 1,800 delighted customers out of 2,000.
Usage: