Exemplo n.º 1
0
        public void GenerateReport(PerformanceReportConfig rpt, string leagueId)
        {
            Lister.SetScorer(rpt.Scorer);
            Lister.SetFormat("weekly");
            Lister.AllWeeks    = false;          //  just the regular saeason
            Lister.Season      = rpt.Week.Season;
            Lister.RenderToCsv = false;
            Lister.Week        = rpt.Week.WeekNo;
            Lister.Collect(rpt.Category, sPos: rpt.Position, fantasyLeague: leagueId);
            Lister.WeeksToGoBack = rpt.WeeksToGoBack;
            string targetFile;

            if (rpt.WeeksToGoBack > 0)
            {
                targetFile = string.Format("{4}{3}//Performance//{2}-Yahoo {1} Performance last {5} upto Week {0:0#}.htm",
                                           rpt.Week.WeekNo, rpt.Position, leagueId, Lister.Season, Utility.OutputDirectory(), rpt.WeeksToGoBack);
            }
            else
            {
                targetFile = string.Format("{4}{3}//Performance//{2}-Yahoo {1} Performance upto Week {0:0#}.htm",
                                           rpt.Week.WeekNo, rpt.Position, leagueId, Lister.Season, Utility.OutputDirectory());
            }
            Lister.Render(targetFile);
            FileOut = targetFile;
            Lister.Clear();
        }
Exemplo n.º 2
0
        private string TargetFile(
            PerformanceReportConfig rpt,
            string leagueId)
        {
            var reptName = (rpt.WeeksToGoBack > 0)
                                ? $"Perf last {rpt.WeeksToGoBack}"
                                : $"Perf ";

            return($@"{
				Utility.OutputDirectory()
				}{
				Lister.Season
				}//Performance//{
				leagueId
				}//{
				rpt.Position
				}//{
				reptName
				} upto Week {rpt.Week.WeekNo:0#}.htm"                );
        }
Exemplo n.º 3
0
        public void GenerateReport(
            PerformanceReportConfig rpt,
            string leagueId)
        {
            Lister.SetScorer(rpt.Scorer);
            Lister.SetFormat("weekly");
            Lister.AllWeeks    = false;          //  just the regular saeason
            Lister.Season      = rpt.Week.Season;
            Lister.RenderToCsv = false;
            Lister.Week        = rpt.Week.WeekNo;
            Lister.Collect(
                rpt.Category,
                sPos: rpt.Position,
                fantasyLeague: leagueId);
            Lister.WeeksToGoBack = rpt.WeeksToGoBack;
            var targetFile = TargetFile(
                rpt,
                leagueId);

            Lister.Render(targetFile);
            FileOut = targetFile;
            Lister.Clear();
        }
 public void GenerateReport( PerformanceReportConfig rpt, string leagueId )
 {
     Lister.SetScorer( rpt.Scorer );
      Lister.SetFormat( "weekly" );
      Lister.AllWeeks = false; //  just the regular saeason
      Lister.Season = rpt.Week.Season;
      Lister.RenderToCsv = false;
      Lister.Week = rpt.Week.WeekNo;
      Lister.Collect( rpt.Category, sPos: rpt.Position, fantasyLeague: leagueId );
      Lister.WeeksToGoBack = rpt.WeeksToGoBack;
      string targetFile;
      if ( rpt.WeeksToGoBack > 0 )
     targetFile = string.Format( "{4}{3}//Performance//{2}-Yahoo {1} Performance last {5} upto Week {0:0#}.htm",
     rpt.Week.WeekNo, rpt.Position, leagueId, Lister.Season, Utility.OutputDirectory(), rpt.WeeksToGoBack );
      else
     targetFile = string.Format( "{4}{3}//Performance//{2}-Yahoo {1} Performance upto Week {0:0#}.htm",
     rpt.Week.WeekNo, rpt.Position, leagueId, Lister.Season, Utility.OutputDirectory() );
      Lister.Render( targetFile );
      FileOut = targetFile;
      Lister.Clear();
 }
        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 );
             }
        }