Пример #1
0
        private static void ScorePlayer(
            RetroRosters sut,
            Player plyr,
            int[] skipWeeks = null)
        {
            var pm = new PlayerReportModel
            {
                PlayerName = plyr.Name,
                Season     = "1988",
                Position   = plyr.Position
            };
            var stats88 = sut.StatsRepo.GetStats(pm);

            if (skipWeeks != null)
            {
                stats88 = RemoveWeeks(stats88, skipWeeks);
            }
            var tds = stats88.Sum(s => s.Scores());

            plyr.CurrentScores = tds;
            pm.Season          = "1989";
            var stats89 = sut.StatsRepo.GetStats(pm);

            tds = stats89.Sum(s => s.Scores());
            plyr.FutureScores = tds;
            plyr.Points       = plyr.CurrentScores + plyr.FutureScores;
        }
Пример #2
0
        public List <GameStats> GetStats(
            int playerId,
            int season,
            params int[] weeks)
        {
            var plyr = GetPlayer(playerId.ToString());
            var pm   = new PlayerReportModel
            {
                PlayerName = plyr.Name,
                Season     = season.ToString(),
                Position   = plyr.Position
            };

            var seasonStats = StatsRepo.GetStats(pm);
            var stats       = seasonStats.Where(s => weeks.Contains(s.Week));

            if (stats.Any())
            {
                return(stats.ToList());
            }
            // send an empty box
            var emptyStats = new List <GameStats>();

            foreach (var w in weeks)
            {
                emptyStats.Add(
                    new GameStats
                {
                    Week = w
                });
            }
            return(emptyStats);
        }
Пример #3
0
        private void ScorePlayer(
            Player plyr)
        {
            var pm = new PlayerReportModel
            {
                PlayerName = plyr.Name,
                Season     = "1988",
                Position   = plyr.Position
            };
            var stats88 = StatsRepo.GetStats(pm);
            var tds     = stats88.Sum(s => s.Scores());

            plyr.CurrentScores = tds;
            pm.Season          = "1989";
            var stats89 = StatsRepo.GetStats(pm);

            tds = stats89.Sum(s => s.Scores());
            plyr.FutureScores = tds;
            plyr.Points       = plyr.CurrentScores + plyr.FutureScores;
        }
Пример #4
0
        public GameLog GameLogFor(
            string season,
            string playerName,
            string position    = "",
            bool sendToConsole = true)
        {
            if (!string.IsNullOrEmpty(position) && position == "KK")
            {
                position = "K";
            }
            var model = new PlayerReportModel
            {
                Season     = season,
                PlayerName = playerName,
                Position   = position
            };

            if (position == "K")
            {
                model.GameLog = _repo.GetKickerStats(model);
            }
            else
            {
                model.GameLog = _repo.GetGameStats(model);
            }

            if (sendToConsole)
            {
                _repo.SendToConsole(
                    model);
            }

            var gameLog = new GameLog
            {
                GameStatsList = model.GameLog
            };

            return(gameLog);
        }
Пример #5
0
        public void TallyPlayer(
            Player plyr,
            string thisSeason = "1988",
            string nextSeason = "1989")
        {
            var pm = new PlayerReportModel
            {
                PlayerName = plyr.Name,
                Season     = thisSeason,
                Position   = plyr.Position
            };
            var stats88 = StatsRepo.GetStats(pm);
            var tds     = stats88.Sum(s => s.Scores());

            plyr.CurrentScores = tds;
            pm.Season          = nextSeason;
            var stats89 = StatsRepo.GetStats(pm);

            tds = stats89.Sum(s => s.Scores());
            plyr.FutureScores = tds;
            plyr.Points       = plyr.CurrentScores + plyr.FutureScores;
        }