public HLTVRating(long steamID, MatchRepository matchRepository) { var allMatchStatisticsForPlayer = matchRepository.GetLastMatchStatisticsForSteamId(steamID, 50); Score = MatchStatisticsCalculator.MatchTypeNormalizedHLTVScore(allMatchStatisticsForPlayer); var latestMatchStatisticForPlayer = matchRepository.GetLatestMatchStatisticForSteamId(steamID); Trend = TrendHelper.GetTrend(Score, latestMatchStatisticForPlayer.HLTVScore); }
public KDRating(IEnumerable <Statistic> playerStatistics) { CheckRequiredStatistics(playerStatistics); var kills = playerStatistics.Single(x => x.Name == "total_kills").Value; var deaths = playerStatistics.Single(x => x.Name == "total_deaths").Value; Score = (double)kills / deaths; var lastMatchKills = playerStatistics.Single(x => x.Name == "last_match_kills").Value; var lastMatchDeaths = playerStatistics.Single(x => x.Name == "last_match_deaths").Value; var lastMatchKD = (double)lastMatchKills / lastMatchDeaths; Trend = TrendHelper.GetTrend(Score, lastMatchKD); }