Beispiel #1
0
        public HeroWinrateDto WinrateAgainstHero(int playerId, int enemyHeroID, bool refresh)
        {
            var data = new HeroWinrateDto();

            if (refresh)
            {
                data.WaitingTime = TaskRegistrator.RegisterMatchListCommand(playerId, null, enemyHeroID, null);
                _unitOfWork.Commit();
                return(data);
            }
            var matches = MatchesRepository.FilteredList(playerId, enemyHeroID);

            if (matches.Count == 0)
            {
                return(null);
            }
            data.Winrate     = CalculationService.GetWinrate(matches, playerId, enemyHeroID);
            data.WaitingTime = 0;
            _unitOfWork.Commit();
            return(data);
        }