Esempio n. 1
0
        public SuggestedLineup(string leagueId, string ownerCode, string teamCode, string season, int week)
        {
#if DEBUG
            Utility.Announce(string.Format("Suggesting a lineup for {0} in league {1} team {2} - {3}:{4}",
                                           ownerCode, leagueId, teamCode, season, week));
#endif
            LeagueId  = leagueId;
            League    = new FantasyLeague(leagueId);
            TeamCode  = teamCode;
            OwnerCode = ownerCode;
            Season    = season;
            Week      = week;
            NflWeek   = new NFLWeek(Season, Week.ToString());
            if (LeagueId.Equals(Constants.K_LEAGUE_Yahoo) || LeagueId.Equals(Constants.K_LEAGUE_PerfectChallenge))
            {
                Scorer = new EspnScorer(NflWeek);
            }
            else
            {
                Scorer = new GS4Scorer(NflWeek);
            }

            _usedPlayers      = new List <NFLPlayer>();
            RankMaster        = new Hashtable();
            IncludeFreeAgents = false;
        }
        public void TestAllPositionsCurrentWeekYahoo()
        {
            var sut = new PerformanceReportGenerator(new TimeKeeper(null) );
             var master = new YahooMaster( "Yahoo", "YahooOutput.xml" );
             var theSeason = Int32.Parse( Utility.CurrentSeason() );
             var weekIn = Utility.PreviousWeek();
             var theWeek =
            new NFLWeek( theSeason, weekIn: weekIn, loadGames: false );
             var gs = new EspnScorer( theWeek ) {Master = master, AnnounceIt = true};
             //var rpt = new PerformanceReportConfig {
             //   Category = Constants.K_QUARTERBACK_CAT, Position = "QB", Scorer = gs, Week = theWeek };

             foreach ( var rpt in sut.Configs )
             {
            sut.GenerateReport( rpt, Constants.K_LEAGUE_Yahoo );
             }
        }
Esempio n. 3
0
        public SuggestedLineup(string leagueId, string ownerCode, string teamCode, string season, int week)
        {
            #if DEBUG2
             Utility.Announce(string.Format("Suggesting a lineup for {0} in league {1} team {2} - {3}:{4}",
                                        ownerCode, leagueId, teamCode, season, week));
            #endif
             LeagueId = leagueId;
             League = new FantasyLeague(leagueId);
             TeamCode = teamCode;
             OwnerCode = ownerCode;
             Season = season;
             Week = week;
             NflWeek = new NFLWeek(Season, Week.ToString());
             if ( LeagueId.Equals( Constants.K_LEAGUE_Yahoo )
            || LeagueId.Equals( Constants.K_LEAGUE_Rants_n_Raves ) )
            Scorer = new EspnScorer(NflWeek);
             else
            Scorer = new GS4Scorer(NflWeek);

             _usedPlayers = new List<NFLPlayer>();
             RankMaster = new Hashtable();
             IncludeFreeAgents = false;
        }
Esempio n. 4
0
        public SuggestedLineup(string leagueId, string ownerCode, string teamCode,
                               IKeepTheTime timekeeper) : base(timekeeper)
        {
#if DEBUG
            Announce($@"Suggesting a lineup for {
			 ownerCode
			 } in league {
			 leagueId
			 } team {
			 teamCode
			 } - {
			 timekeeper.Season}:{timekeeper.Week}"            );
#endif
            LeagueId  = leagueId;
            League    = new FantasyLeague(leagueId);
            TeamCode  = teamCode;
            OwnerCode = ownerCode;
            Season    = timekeeper.CurrentSeason();
            Week      = Int32.Parse(timekeeper.Week);
            NflWeek   = new NFLWeek(Season, Week.ToString());
            if (LeagueId.Equals(Constants.K_LEAGUE_Yahoo) ||
                LeagueId.Equals(Constants.K_LEAGUE_Rants_n_Raves))
            {
                Scorer = new EspnScorer(NflWeek);
            }
            else
            {
                Scorer = new GS4Scorer(NflWeek);
            }
#if DEBUG
            Scorer.AnnounceIt = true;
#endif
            _usedPlayers      = new List <NFLPlayer>();
            RankMaster        = new Hashtable();
            IncludeFreeAgents = false;
        }
Esempio n. 5
0
        public PerformanceReportGenerator(IKeepTheTime timekeeper) : base(timekeeper)
        {
            Logger = LogManager.GetCurrentClassLogger();
            Name   = "Fantasy Performance Reports";
            Lister = new PlayerLister(timekeeper)
            {
                WeeksToGoBack = 1,
                StartersOnly  = false
            };

            var master = new YahooMaster("Yahoo", "YahooOutput.xml");

            Logger.Trace("  using {0} which has {1} stats", master.Filename, master.TheHt.Count);

            var theWeek =
                new NFLWeek(Int32.Parse(timekeeper.CurrentSeason()),
                            weekIn: Int32.Parse(timekeeper.PreviousWeek()),
                            loadGames: false);

            var gs = new EspnScorer(theWeek)
            {
                Master = master
            };

            Configs = new List <PerformanceReportConfig>
            {
                new PerformanceReportConfig
                {
                    Category = Constants.K_QUARTERBACK_CAT,
                    Position = "QB",
                    Scorer   = gs,
                    Week     = theWeek
                },
                new PerformanceReportConfig
                {
                    Category = Constants.K_RUNNINGBACK_CAT,
                    Position = "RB",
                    Scorer   = gs,
                    Week     = theWeek
                },
                new PerformanceReportConfig
                {
                    Category = Constants.K_RECEIVER_CAT,
                    Position = "WR",
                    Scorer   = gs,
                    Week     = theWeek
                },
                new PerformanceReportConfig
                {
                    Category = Constants.K_RECEIVER_CAT,
                    Position = "TE",
                    Scorer   = gs,
                    Week     = theWeek
                },
                new PerformanceReportConfig
                {
                    Category = Constants.K_KICKER_CAT,
                    Position = "PK",
                    Scorer   = gs,
                    Week     = theWeek
                },
                //  4 weeks back
                new PerformanceReportConfig
                {
                    Category      = Constants.K_QUARTERBACK_CAT,
                    Position      = "QB",
                    Scorer        = gs,
                    Week          = theWeek,
                    WeeksToGoBack = 4
                },
                new PerformanceReportConfig
                {
                    Category      = Constants.K_RUNNINGBACK_CAT,
                    Position      = "RB",
                    Scorer        = gs,
                    Week          = theWeek,
                    WeeksToGoBack = 4
                },
                new PerformanceReportConfig
                {
                    Category      = Constants.K_RECEIVER_CAT,
                    Position      = "WR",
                    Scorer        = gs,
                    Week          = theWeek,
                    WeeksToGoBack = 4
                },
                new PerformanceReportConfig
                {
                    Category      = Constants.K_RECEIVER_CAT,
                    Position      = "TE",
                    Scorer        = gs,
                    Week          = theWeek,
                    WeeksToGoBack = 4
                },
                new PerformanceReportConfig
                {
                    Category      = Constants.K_KICKER_CAT,
                    Position      = "PK",
                    Scorer        = gs,
                    Week          = theWeek,
                    WeeksToGoBack = 4
                },

                //  1 week back
                new PerformanceReportConfig
                {
                    Category      = Constants.K_QUARTERBACK_CAT,
                    Position      = "QB",
                    Scorer        = gs,
                    Week          = theWeek,
                    WeeksToGoBack = 1
                },
                new PerformanceReportConfig
                {
                    Category      = Constants.K_RUNNINGBACK_CAT,
                    Position      = "RB",
                    Scorer        = gs,
                    Week          = theWeek,
                    WeeksToGoBack = 1
                },
                new PerformanceReportConfig
                {
                    Category      = Constants.K_RECEIVER_CAT,
                    Position      = "WR",
                    Scorer        = gs,
                    Week          = theWeek,
                    WeeksToGoBack = 1
                },
                new PerformanceReportConfig
                {
                    Category      = Constants.K_RECEIVER_CAT,
                    Position      = "TE",
                    Scorer        = gs,
                    Week          = theWeek,
                    WeeksToGoBack = 1
                },
                new PerformanceReportConfig
                {
                    Category      = Constants.K_KICKER_CAT,
                    Position      = "PK",
                    Scorer        = gs,
                    Week          = theWeek,
                    WeeksToGoBack = 1
                },
            };

            Leagues = new List <RosterGridLeague>();
            Leagues.Add(new RosterGridLeague {
                Id = Constants.K_LEAGUE_Yahoo, Name = "Spitzys League"
            });
#if !DEBUG
            Leagues.Add(new RosterGridLeague {
                Id = Constants.K_LEAGUE_Gridstats_NFL1, Name = "Gridstats GS1"
            });
            //Leagues.Add( new RosterGridLeague { Id = Constants.K_LEAGUE_Rants_n_Raves, Name = "NFL.COM" } );
#endif
        }
        public PerformanceReportGenerator(IKeepTheTime timekeeper)
        {
            Logger = LogManager.GetCurrentClassLogger();
             Name = "Fantasy Performance Reports";
             Lister = new PlayerLister( timekeeper ) {
            WeeksToGoBack = 1,
            StartersOnly = false
             };

             var master = new YahooMaster( "Yahoo", "YahooOutput.xml" );
             Logger.Info( "  using {0} which has {1} stats", master.Filename, master.TheHt.Count );

             var theWeek =
            new NFLWeek( Int32.Parse( timekeeper.CurrentSeason() ),
            weekIn: Int32.Parse( timekeeper.PreviousWeek() ),
            loadGames: false );

             var gs = new EspnScorer( theWeek ) { Master = master };

             Configs = new List<PerformanceReportConfig>
            {
               new PerformanceReportConfig
                  {
                     Category = Constants.K_QUARTERBACK_CAT,
                     Position = "QB",
                     Scorer = gs,
                     Week = theWeek
                  },
               new PerformanceReportConfig
                  {
                     Category = Constants.K_RUNNINGBACK_CAT,
                     Position = "RB",
                     Scorer = gs,
                     Week = theWeek
                  },
               new PerformanceReportConfig
                  {
                     Category = Constants.K_RECEIVER_CAT,
                     Position = "WR",
                     Scorer = gs,
                     Week = theWeek
                  },
               new PerformanceReportConfig
                  {
                     Category = Constants.K_RECEIVER_CAT,
                     Position = "TE",
                     Scorer = gs,
                     Week = theWeek
                  },
               new PerformanceReportConfig
                  {
                     Category = Constants.K_KICKER_CAT,
                     Position = "PK",
                     Scorer = gs,
                     Week = theWeek
                  },
               //  4 weeks back
               new PerformanceReportConfig
                  {
                     Category = Constants.K_QUARTERBACK_CAT,
                     Position = "QB",
                     Scorer = gs,
                     Week = theWeek,
                     WeeksToGoBack = 4
                  },
               new PerformanceReportConfig
                  {
                     Category = Constants.K_RUNNINGBACK_CAT,
                     Position = "RB",
                     Scorer = gs,
                     Week = theWeek,
                     WeeksToGoBack = 4
                  },
               new PerformanceReportConfig
                  {
                     Category = Constants.K_RECEIVER_CAT,
                     Position = "WR",
                     Scorer = gs,
                     Week = theWeek,
                     WeeksToGoBack = 4
                  },
               new PerformanceReportConfig
                  {
                     Category = Constants.K_RECEIVER_CAT,
                     Position = "TE",
                     Scorer = gs,
                     Week = theWeek,
                     WeeksToGoBack = 4
                  },
               new PerformanceReportConfig
                  {
                     Category = Constants.K_KICKER_CAT,
                     Position = "PK",
                     Scorer = gs,
                     Week = theWeek,
                     WeeksToGoBack = 4
                  },

               //  1 week back
               new PerformanceReportConfig
                  {
                     Category = Constants.K_QUARTERBACK_CAT,
                     Position = "QB",
                     Scorer = gs,
                     Week = theWeek,
                     WeeksToGoBack = 1
                  },
               new PerformanceReportConfig
                  {
                     Category = Constants.K_RUNNINGBACK_CAT,
                     Position = "RB",
                     Scorer = gs,
                     Week = theWeek,
                     WeeksToGoBack = 1
                  },
               new PerformanceReportConfig
                  {
                     Category = Constants.K_RECEIVER_CAT,
                     Position = "WR",
                     Scorer = gs,
                     Week = theWeek,
                     WeeksToGoBack = 1
                  },
               new PerformanceReportConfig
                  {
                     Category = Constants.K_RECEIVER_CAT,
                     Position = "TE",
                     Scorer = gs,
                     Week = theWeek,
                     WeeksToGoBack = 1
                  },
               new PerformanceReportConfig
                  {
                     Category = Constants.K_KICKER_CAT,
                     Position = "PK",
                     Scorer = gs,
                     Week = theWeek,
                     WeeksToGoBack = 1
                  },
            };

             Leagues = new List<RosterGridLeague>();
             Leagues.Add( new RosterGridLeague { Id = Constants.K_LEAGUE_Yahoo, Name = "Spitzys League" } );
            #if ! DEBUG
             Leagues.Add( new RosterGridLeague { Id = Constants.K_LEAGUE_Gridstats_NFL1, Name = "Gridstats GS1" } );
             //Leagues.Add( new RosterGridLeague { Id = Constants.K_LEAGUE_Rants_n_Raves, Name = "NFL.COM" } );
            #endif
        }
        public void TestGoBackOneMonth()
        {
            var sut = new PerformanceReportGenerator(new TimeKeeper(null) );
             var master = new YahooMaster( "Yahoo", "YahooOutput.xml" );
             var theSeason = Int32.Parse( Utility.CurrentSeason() );
             var weekIn = Utility.PreviousWeek();
             var theWeek =
            new NFLWeek( theSeason, weekIn: weekIn, loadGames: false );
             var gs = new EspnScorer( theWeek ) { Master = master, AnnounceIt = true };
             var configs = new List<PerformanceReportConfig>();
             var rpt = new PerformanceReportConfig
             {
            Category = Constants.K_QUARTERBACK_CAT,
            Position = "QB",
            Scorer = gs,
            Week = theWeek,
            WeeksToGoBack = 4
             };
             configs.Add( rpt );
             sut.Configs = configs;  //  overwrite the default configs

             foreach ( var r in sut.Configs )
             {
            sut.GenerateReport( r, Constants.K_LEAGUE_Yahoo );
             }
        }