예제 #1
0
        private decimal GetPositivUserRaitingValue(ContactCollection contactCollection)
        {
            var starRatings = 0m;

            foreach (var contact in contactCollection.Contacts)
            {
                var hasRaiting = contact.RatingScore.HasValue;
                if (hasRaiting)
                {
                    var raitingValue = contact.RatingScore;

                    // 1 has a neutral contribution
                    if (raitingValue == 3)
                    {
                        starRatings += 3;
                    }
                    else if (raitingValue == 4)
                    {
                        starRatings += 9;
                    }
                    else if (raitingValue == 5)
                    {
                        starRatings += 27;
                    }
                }
            }

            return(starRatings);
        }
예제 #2
0
        private decimal GetAutoRaitingValues(ContactCollection contactCollection)
        {
            var starRatings = 0m;

            foreach (var contact in contactCollection.Contacts)
            {
                var hasAutoRaiting = contact.AutoRatingScore.HasValue;

                if (hasAutoRaiting)
                {
                    var raitingValue = contact.AutoRatingScore;

                    // 1 has a neutral contribution
                    if (raitingValue == 2)
                    {
                        starRatings += 1;
                    }
                    else if (raitingValue == 3)
                    {
                        starRatings += 3;
                    }
                    else if (raitingValue == 4)
                    {
                        starRatings += 9;
                    }
                    else if (raitingValue == 5)
                    {
                        starRatings += 27;
                    }
                }
                else // fix for missing auto ratings on first release
                {
                    starRatings += 3;
                }
            }

            return(starRatings);
        }