public List <ExpertStat> GenerateExpertsOverallRating() { var fetchStrategies = new IFetchStrategy <Expert>[] { new Persistence.DAL.FetchStrategies.ExpertsFetchStrategies.ExpertsFetchPredictions() }; var experts = _context.GetExperts(fetchStrategies).ToList <Expert>(); var validExperts = experts.Where(e => !e.Predictions.ToList().IsNullOrEmpty()); var expertStats = validExperts.Select(e => new ExpertStat(e.Nickname, e.Predictions.Count, Math.Round((double)e.GetPredictionsSum() / e.Predictions.Count, 2), e.GetPredictionsSum())) .ToList(); for (int i = 0; i < expertStats.Count; i++) { if (expertStats[i].Nickname == "Mary I Tudor") { expertStats[i].Sum += 6; expertStats[i].AvgSum = Math.Round((double)expertStats[i].Sum / expertStats[i].PredictionsCount, 2); } } return(expertStats); }
public IReadOnlyList <Expert> GetExperts() { return(_context.GetExperts().ToList()); }