public YahooMasterGenerator( bool fullSeason, IKeepTheTime timeKeeper )
 {
     Name = "Yahoo Master Generator";
      YahooMaster = new YahooMaster("Yahoo", "YahooOutput.xml");
      Logger = LogManager.GetCurrentClassLogger();
      FullSeason = fullSeason;
      TimeKeeper = timeKeeper;
 }
Exemplo n.º 2
0
 public YahooMasterGenerator(
     bool fullSeason,
     IKeepTheTime timekeeper) : base(timekeeper)
 {
     Name        = "Yahoo Master Generator";
     YahooMaster = new YahooMaster("Yahoo", "YahooOutput.xml");
     Logger      = LogManager.GetCurrentClassLogger();
     FullSeason  = fullSeason;
     TimeKeeper  = timekeeper;
 }
        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 );
             }
        }
 public override void RenderAsHtml()
 {
     if (FullSeason)
     {
         YahooMaster.Calculate(TimeKeeper.Season);
         Logger.Info("  Generating Yahoo xml for full Season}");
     }
     else
     {
         Logger.Info(
             "  Generating Yahoo xml for Season {0} Week {1}",
             TimeKeeper.Season, TimeKeeper.Week);
         YahooMaster.Calculate(
             TimeKeeper.Season,
             TimeKeeper.PreviousWeek());
     }
     YahooMaster.Dump2Xml(Logger);
 }
Exemplo n.º 5
0
 public void TestGenerateYahooXmlForEntireSeason()
 {
     var m = new YahooMaster( "Yahoo", "YahooOutput.xml" );
      m.Calculate( "2015" );
      m.Dump2Xml();
 }
Exemplo n.º 6
0
 public void TestGenerateYahooXml()
 {
     var m = new YahooMaster( "Yahoo", "YahooOutput.xml" );
      m.Calculate( season: "2016", week: "09" );
      m.Dump2Xml();
 }
Exemplo n.º 7
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
        }
        private static string WeeklyEspnPerformance(
         string catCode, int week, string leagueId, [System.Runtime.InteropServices.Optional] string sPos )
        {
            var pl = new PlayerLister { WeeksToGoBack = 1 };
             var master = new YahooMaster( "Yahoo", "YahooOutput.xml" );
             var currentWeek =
            new NFLWeek( Int32.Parse( Utility.CurrentSeason() ), weekIn: week, loadGames: false );
             var gs = new YahooScorer( currentWeek ) { Master = master };

             pl.SetScorer( gs );
             pl.SetFormat( "weekly" );
             pl.AllWeeks = false; //  just the regular saeason
             pl.Season = currentWeek.Season;
             pl.RenderToCsv = false;
             pl.Week = week;
             pl.Collect( catCode, sPos: sPos, fantasyLeague: leagueId );

             var targetFile = string.Format( "{4}{3}//Performance//{2}-Yahoo {1} Performance upto Week {0}.htm",
            currentWeek.WeekNo, sPos, leagueId, pl.Season, Utility.OutputDirectory() );
             pl.Render( targetFile );
             return pl.FileOut;
        }
        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 );
             }
        }
 public void TestGenYahooAllPositionsCurrentWeek()
 {
     var m = new YahooMaster( "Yahoo", "YahooOutput.xml" );
      m.Calculate( "2014", "09" );
      m.Dump2Xml();
      Assert.IsTrue( File.Exists( m.Filename ) );
      //TestAllPositionsBeastModeCurrentWeek();
      TestAllPositionsYahooCurrentWeek();
      //TestAllPositionsRantsCurrentWeek();
 }
Exemplo n.º 12
0
 public override void RenderFullAsHtml()
 {
     YahooMaster.Calculate(TimeKeeper.Season);
     YahooMaster.Dump2Xml(Logger);
 }