Esempio n. 1
0
        private void TallyStats()
        {
            var pList = PlayerList.GetAll();

            foreach (var plyr in pList)
            {
                var player    = new NFLPlayer(plyr.Id);
                var scorecard = new ScoreCard
                {
                    Player = player
                };
                var season = PgmDao.GetSeason(
                    Season,
                    player.PlayerCode);

                if (Week == "00")
                {
                    TallyPreviousActuals(
                        scorecard,
                        player);
                }

                TallyPredictions(
                    scorecard,
                    player,
                    season);

                if (Int32.Parse(Week) > 0)
                {
                    TallyActuals(scorecard, player, season);
                }
                ScoreCards.Add(scorecard);
            }
        }
Esempio n. 2
0
 public FantasyScorecardReport(
     IKeepTheTime timekeeper,
     IPlayerGameMetricsDao pgmDao) : base(timekeeper)
 {
     Name           = "Fantasy Scorecard";
     Season         = timekeeper.CurrentSeason();
     Week           = timekeeper.Week;
     PlayerIds      = new List <string>();
     PgmDao         = pgmDao;
     ScoreCards     = new List <ScoreCard>();
     TotalScoreCard = new ScoreCard();
 }
Esempio n. 3
0
 private void OutputPriors(
     StringBuilder sb,
     ScoreCard card)
 {
     sb.Append(new string(' ', 19));
     sb.Append($"{card.PreviousTotalPoints,11:0.0}");
     for (int w = 1; w < 17; w++)
     {
         sb.Append($"{card.LastYearWeek[w],9:0.0}");
     }
     sb.AppendLine();
 }
Esempio n. 4
0
 private static int CompareByTotalPoints(
     ScoreCard x,
     ScoreCard y)
 {
     if (x == null)
     {
         if (y == null)
         {
             return(0);
         }
         return(-1);
     }
     return(y == null ? 1 : y.TotalPoints.CompareTo(x.TotalPoints));
 }
Esempio n. 5
0
 private void TallyActuals(
     ScoreCard scorecard,
     NFLPlayer player,
     List <PlayerGameMetrics> season)
 {
     foreach (var pgm in season)
     {
         scorecard.TotalPoints += pgm.CalculateActualFantasyPoints(
             player);
     }
     for (int w = 1; w < 17; w++)
     {
         scorecard.Week[w - 1] = Decimal.Parse(
             TotalFor(w, season, player));
     }
 }
Esempio n. 6
0
 private void TallyPredictions(
     ScoreCard scorecard,
     NFLPlayer player,
     List <PlayerGameMetrics> season)
 {
     scorecard.TotalPoints = TotalPredictonFor(
         season,
         player);
     for (int w = 1; w < 17; w++)
     {
         scorecard.Week[w]
             = PredictonFor(w, season, player)
               * player.HealthRating()
               * player.AgeRating();
         TotalScoreCard.Week[w]     += scorecard.Week[w];
         TotalScoreCard.TotalPoints += scorecard.Week[w];
     }
 }
Esempio n. 7
0
        private void TallyPreviousActuals(
            ScoreCard scorecard,
            NFLPlayer player)
        {
            var season = PgmDao.GetSeason(
                PreviousSeason(Season),
                player.PlayerCode);

            scorecard.PreviousTotalPoints =
                decimal.Parse(TotalFor(season, player));
            for (int w = 1; w < 17; w++)
            {
                var actualForTheWeek = decimal.Parse(
                    TotalFor(
                        w,
                        season,
                        player));
                scorecard.LastYearWeek[w]           = actualForTheWeek;
                TotalScoreCard.LastYearWeek[w]     += actualForTheWeek;
                TotalScoreCard.PreviousTotalPoints += actualForTheWeek;
            }
        }