public double CalculateAdviseGroupRank(AdviseGroupContent adviseGroup, PlaybacksInfo playbacksInfo)
        {
            var playbacksPassed = playbacksInfo.GetPlaybacksPassed(adviseGroup);

            return(playbacksPassed == Int32.MaxValue ? MaxRank :
                   GetFactorForAdviseGroupSize(adviseGroup.AdviseSets.Count(x => !x.IsDeleted)) *
                   GetFactorForAverageRating(GetRating(adviseGroup)) *
                   GetFactorForPlaybackAge(playbacksPassed));
        }
        public double CalculateAdviseSetRank(AdviseSetContent adviseSet, PlaybacksInfo playbacksInfo)
        {
            if (adviseSet.LastPlaybackTime == null)
            {
                return(MaxRank);
            }

            var playbacksPassed = playbacksInfo.GetPlaybacksPassed(adviseSet);

            return(GetFactorForAverageRating(GetRating(adviseSet)) * GetFactorForPlaybackAge(playbacksPassed));
        }
        public double CalculateSongRank(SongModel song, PlaybacksInfo playbacksInfo)
        {
            if (!song.LastPlaybackTime.HasValue)
            {
                return(MaxRank);
            }

            var factorForRating       = GetFactorForRating(song.GetRatingOrDefault());
            var factorForPlaybacksAge = GetFactorForPlaybackAge(playbacksInfo.GetPlaybacksPassed(song));

            return(factorForRating * factorForPlaybacksAge);
        }
 public IEnumerable <AdviseSetContent> SortAdviseSets(IEnumerable <AdviseSetContent> adviseSets, PlaybacksInfo playbacksInfo)
 {
     return(adviseSets
            .OrderByDescending(x => adviseRankCalculator.CalculateAdviseSetRank(x, playbacksInfo)));
 }