public YahooMasterGenerator( bool fullSeason, IKeepTheTime 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 );
             }
        }
示例#3
0
 public void TestGenerateYahooXmlForEntireSeason()
 {
     var m = new YahooMaster( "Yahoo", "YahooOutput.xml" );
      m.Calculate( "2015" );
      m.Dump2Xml();
 }
示例#4
0
 public void TestGenerateYahooXml()
 {
     var m = new YahooMaster( "Yahoo", "YahooOutput.xml" );
      m.Calculate( season: "2016", week: "09" );
      m.Dump2Xml();
 }
        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();
 }