예제 #1
0
        public StatDTO GetStats()
        {
            CheckPlayerLog();
            var result = new StatDTO()
            {
            };
            var todayStat = _episodeRepository.GetTodayStats();

            result.TodayStats = new SessionStatDTO
            {
                CrownCount   = todayStat?.CrownCount ?? 0,
                EpisodeCount = todayStat?.EpisodeCount ?? 0,
                // TODO add cheater count
                CheaterCount = 0
            };
            var seasonStat = _episodeRepository.GetSeasonStats(1);

            result.SeasonStats = new SessionStatDTO
            {
                CrownCount   = seasonStat?.CrownCount ?? 0,
                EpisodeCount = seasonStat?.EpisodeCount ?? 0,
                // TODO add cheater count
                CheaterCount = 0
            };
            //_logger.LogInformation($"Current Round: {LogParserV2.currentRound}");
            result.RoundStats = _episodeRepository.GetRoundStats(LogParserV2.currentRound);
            if (result.RoundStats == null)
            {
                result.RoundStats = new RoundStatsDto
                {
                    GoldCount         = 0,
                    SilverCount       = 0,
                    BronzeCount       = 0,
                    QualifiedCount    = 0,
                    NotQualifiedCount = 0,
                    RoundType         = LogParserV2.currentRound
                }
            }
            ;

            string readableRoundType;

            if (RoundEntity.RoundTypeMap.TryGetValue(LogParserV2.currentRound, out readableRoundType))
            {
                result.CurrentRound = readableRoundType;
            }
            result.Streak = _episodeRepository.GetStreak();
            return(result);
        }