public RatingResult ComputeRating(int numberOfReviews)
        {
            var result = new RatingResult();

            result.Rating = 4;
            return(result);
        }
Example #2
0
        public RatingResult ComputeRating(int numberOfReviews)
        {
            var result = new RatingResult();

            result.Rating = (int)_restaurant.Reviews.Average(r => r.Rating);
            return(result);
        }
Example #3
0
        public RatingResult Compute(IList <RestaurantReview> reviews)
        {
            var result = new RatingResult();

            result.Rating = (int)reviews.Average(review => review.Rating);
            return(result);
        }
Example #4
0
        public RatingResult Compute(List <RestaurantReview> reviews)
        {
            var result  = new RatingResult();
            int counter = 0;
            int total   = 0;

            for (int i = 0; i < reviews.Count(); i++)
            {
                if (i < reviews.Count() / 2)
                {
                    counter += 2;
                    total   += reviews[i].Rating * 2;
                }
                else
                {
                    counter += 1;
                    total   += reviews[i].Rating;
                }
            }
            result.Rating = total / counter;
            return(result);
        }
        public RatingResult Compute(IList<RestrauntReview> reviews)
        {
            var result = new RatingResult();
            var counter = 0;
            var total = 0;

            for (int i = 0; i < reviews.Count(); i++)
            {
                if (i < reviews.Count() / 2)
                {
                    counter += 2;
                    total += reviews[i].Rating * 2;
                }
                else
                {
                    counter += 1;
                    total += reviews[i].Rating;
                }
            }
            result.Rating = total / counter;
            return result;
        }
        public RatingResult ComputeWeightedRate(int numberOfReviews)
        {
            var reviews = _restaurant.Reviews.ToArray();
            var result = new RatingResult();
            var counter = 0;
            var total = 0;

            for (int i = 0; i < reviews.Count(); i++) {
                if (i < reviews.Count() / 2)
                {
                    counter += 2;
                    total += reviews[i].Rating * 2;
                }
                else
                {
                    counter += 1;
                    total += reviews[i].Rating;
                }
            }

            result.Rating = total / counter;
            return result;
        }
Example #7
0
        public RatingResult ComputeWeightedRate(int numberOfReviews)
        {
            var reviews = _restaurant.Reviews.ToArray();
            var result  = new RatingResult();
            var counter = 0;
            var total   = 0;

            for (int i = 0; i < reviews.Count(); i++)
            {
                if (i < reviews.Count() / 2)
                {
                    counter += 2;
                    total   += reviews[i].Rating * 2;
                }
                else
                {
                    counter += 1;
                    total   += reviews[i].Rating;
                }
            }

            result.Rating = total / counter;
            return(result);
        }
Example #8
0
 public RatingResult Compute(IList<RestaurantReview> reviews)
 {
     var result = new RatingResult();
     result.Rating = (int)reviews.Average(r => r.Rating);
     return result;
 }
 public RatingResult ComputeRating(int numberOfReviews)
 {
     var result = new RatingResult();
     result.Rating = (int)_restaurant.Reviews.Average(r => r.Rating);
     return result;
 }
Example #10
0
 public RatingResult ComputeRating(int p)
 {
     var result = new RatingResult();
     result.Rating = 4;
     return result;
 }