Exemplo n.º 1
0
        private QualityAd TransformAdToQualityAd(AdVO ad)
        {
            var qualityAd = new QualityAd
            {
                Id          = ad.Id,
                Typology    = ad.Description,
                Description = ad.Description,
                PictureUrls = _picturesRepository.GetPictures(ad.Pictures).Select(c => c.Url).ToList(),
                HouseSize   = ad.HouseSize ?? 0,
                GardenSize  = ad.GardenSize ?? 0,
                Score       = ad.Score ?? 0,
            };

            if (ad.IrrelevantSince.HasValue)
            {
                qualityAd.IrrelevantSince = ad.IrrelevantSince.Value;
            }

            return(qualityAd);
        }
Exemplo n.º 2
0
        public int Calculate(AdVO ad)
        {
            if (ad.Pictures == null || ad.Pictures.Count() == 0)
            {
                return(-10);
            }

            var score    = 0;
            var pictures = _picturesRepository.GetPictures(ad.Pictures);

            score += 20 * pictures.Count(c => c.Quality.Equals(HD));
            score += 10 * pictures.Count(c => c.Quality.Equals(SD));

            return(score);
        }