public FantasyProjectionReporter( IKeepTheTime timekeeper) { Name = "Fantasy Point Projections"; TimeKeeper = timekeeper; var dao = new DbfPlayerGameMetricsDao(); var scorer = new YahooProjectionScorer(); var theWeek = TimeKeeper.CurrentWeek( DateTime.Now ); if (theWeek.Equals( 0 )) theWeek = 1; Configs = new List<FantasyProjectionReportConfig> { new FantasyProjectionReportConfig { Season = TimeKeeper.CurrentSeason( DateTime.Now ), Week = theWeek.ToString( CultureInfo.InvariantCulture ), Dao = dao, Scorer = scorer } }; Leagues = new List<RosterGridLeague>(); //Leagues.Add(new RosterGridLeague { // Id = Constants.K_LEAGUE_Gridstats_NFL1, Name = "Gridstats GS1" //}); Leagues.Add( new RosterGridLeague { Id = Constants.K_LEAGUE_Yahoo, Name = "Spitzys" } ); //Leagues.Add( new RosterGridLeague //{ // Id = Constants.K_LEAGUE_Rants_n_Raves, // Name = "NFL.com" //} ); }
public RecordOfActualMetricsReport(string season, string week) { Name = "Recording Actual Player Metrics Log"; Season = season; Week = week; Dao = new DbfPlayerGameMetricsDao(); }
public YahooScorer( NFLWeek week ) { Name = "Yahoo Scorer"; Week = week; PgmDao = new DbfPlayerGameMetricsDao(); Logger = NLog.LogManager.GetCurrentClassLogger(); }
private decimal PointsFor(NFLPlayer plyr, int increment, string forScoreType, string id) { // nScores could be TDs, FGs or PATs decimal nScores = 0M; if (Week.HasPassed()) { var ds = plyr.LastScores(forScoreType, Week.WeekNo, Week.WeekNo, Week.Season, id); nScores = ds.Tables[0].Rows.Count; } else { var dao = new DbfPlayerGameMetricsDao(); var gameCode = Week.GameCodeFor(plyr.TeamCode); if (!string.IsNullOrEmpty(gameCode)) { var pgm = dao.GetPlayerWeek(gameCode, plyr.PlayerCode); nScores = pgm.ProjectedScoresOfType(forScoreType, id); } } decimal points = nScores * increment; switch (forScoreType) { case Constants.K_SCORE_TD_PASS: if (plyr.PlayerCat.Equals(Constants.K_QUARTERBACK_CAT) && (id == "2")) { plyr.ProjectedTDp = nScores; PointsLine("Tdp", plyr.PlayerNameShort, points); } else { plyr.ProjectedTDc = nScores; PointsLine("TDc", plyr.PlayerNameShort, points); } break; case Constants.K_SCORE_TD_RUN: PointsLine("Tdr", plyr.PlayerNameShort, points); plyr.ProjectedTDr = nScores; break; case Constants.K_SCORE_FIELD_GOAL: PointsLine("FG ", plyr.PlayerNameShort, points); plyr.ProjectedFg = ( int )nScores; break; case Constants.K_SCORE_PAT: break; default: Utility.Announce(string.Format("GS4Scorer: Unknown score type {0}", forScoreType)); break; } #if DEBUG Utility.Announce($"{plyr.PlayerNameShort} gets {points} for score type {Utility.ScoreTypeOut( forScoreType )}"); #endif return(points); }
public RecordOfActualMetricsReport(IKeepTheTime timekeeper) : base(timekeeper) { Name = "Recording Actual Player Metrics Log"; Season = timekeeper.CurrentSeason(DateTime.Now); Week = string.Format("{0:00}", timekeeper.CurrentWeek(DateTime.Now)); Dao = new DbfPlayerGameMetricsDao(); }
public FpProjections() { Name = "FP Projections"; Fpr = new FantasyProjectionReport(); Dao = new DbfPlayerGameMetricsDao(); // for fetching the metrics (but they need generation) Scorer = new YahooProjectionScorer(); Configure(); }
public FpProjections(IKeepTheTime timekeeper) : base(timekeeper) { Name = "FP Projections"; Fpr = new FantasyProjectionReport(); Dao = new DbfPlayerGameMetricsDao(); // for fetching the metrics (but they need generation) Scorer = new YahooProjectionScorer(); Configure(); }
public YahooScorer(NFLWeek week) { Name = "Yahoo Scorer"; Week = week; PgmDao = new DbfPlayerGameMetricsDao(); // should be injected YahooStatService = new YahooStatService(); Logger = LogManager.GetCurrentClassLogger(); UseProjections = true; }
public void TestRenderRantsProjection() { var dao = new DbfPlayerGameMetricsDao(); // Could use a Fake here var scorer = new YahooProjectionScorer(); // Could use a Fake here var sut = new FantasyProjectionReport("2013", "2", dao, scorer) {League = Constants.K_LEAGUE_Rants_n_Raves}; sut.RenderAll(); var fileOut = sut.FileName(); Assert.IsTrue(File.Exists(fileOut)); }
public void TestFileGetsOutputForSF() { // small focused test on specific criteria var dao = new DbfPlayerGameMetricsDao(); // Could use a Fake here var scorer = new YahooProjectionScorer(); // Could use a Fake here var sut = new FantasyProjectionReport( "2014", "01", dao, scorer ) {TeamFilter = "SF", CategoryFilter = "3"}; sut.Render(); var fileOut = sut.FileName(); Assert.IsTrue(File.Exists(fileOut)); }
public void TestPmetricsGet() { var player = new NFLPlayer("MANNPE01"); var week = new NFLWeek("2014", 1); var gameCode = week.GameCodeFor("DB"); var dao = new DbfPlayerGameMetricsDao(); var pgm = dao.GetPlayerWeek(gameCode, player.PlayerCode); Assert.IsTrue(pgm.ProjYDp.Equals(300)); }
public void TestRenderAllFantasyProjections() { // test a league using yahoo scoring - takes a fair while // out put goes here g:\FileSync\SyncProjects\GerardGui\Gerard.Tests\bin\Debug\Output\2014\Projections\ var dao = new DbfPlayerGameMetricsDao(); // Could use a Fake here var scorer = new YahooProjectionScorer(); // Could use a Fake here var sut = new FantasyProjectionReport( "2015", "04", dao, scorer ) {League = Constants.K_LEAGUE_Yahoo}; sut.RenderAll(); var fileOut = sut.FileName(); Assert.IsTrue( File.Exists(fileOut ) ); }
public void TestASavingMetrics() { var msg = new PlayerGameProjectionMessage {Game = new NFLGame( "2013:01-B" )}; var sut = new GetGamePrediction( msg ); var sut2 = new PullMetricsFromPrediction( msg ); var sut3 = new SavePlayerGameMetrics( msg ); var dpgmDoa = new DbfPlayerGameMetricsDao(); var pgmList = msg.Game.PlayerGameMetrics; var expectedPgm = pgmList.FirstOrDefault(); var pgm = dpgmDoa.Get( expectedPgm.PlayerId, expectedPgm.GameKey ); Assert.IsNotNull( pgm ); }
public void TestFileGetsOutputForWR() { var dao = new DbfPlayerGameMetricsDao(); // Could use a Fake here var scorer = new YahooProjectionScorer(); // Could use a Fake here var sut = new FantasyProjectionReport( "2014", "1", dao, scorer ) { League = Constants.K_LEAGUE_Gridstats_NFL1, CategoryFilter = "3" }; sut.Render(); var fileOut = sut.FileName(); Assert.IsTrue(File.Exists(fileOut)); }
public void TestRatePlayerProjection() { var p = new NFLPlayer( "TAYLTY01" ); var sut = new DbfPlayerGameMetricsDao(); var pgms = sut.GetSeason("2016", "TAYLTY01"); var totalPoints = 0.0M; foreach ( var pgm in pgms ) { pgm.CalculateProjectedFantasyPoints( p ); totalPoints += p.Points; } Assert.IsTrue(p.Points < 400M); }
public FantasyProjectionReporter(IKeepTheTime timekeeper) : base(timekeeper) { Name = "Fantasy Point Projections"; TimeKeeper = timekeeper; var dao = new DbfPlayerGameMetricsDao(); var scorer = new YahooProjectionScorer(); var theWeek = TimeKeeper.CurrentWeek(DateTime.Now); if (theWeek.Equals(0)) { theWeek = 1; } Configs = new List <FantasyProjectionReportConfig> { new FantasyProjectionReportConfig { Season = TimeKeeper.CurrentSeason(DateTime.Now), Week = theWeek.ToString(CultureInfo.InvariantCulture), Dao = dao, Scorer = scorer } }; Leagues = new List <RosterGridLeague>(); //Leagues.Add(new RosterGridLeague { // Id = Constants.K_LEAGUE_Gridstats_NFL1, Name = "Gridstats GS1" //}); Leagues.Add(new RosterGridLeague { Id = Constants.K_LEAGUE_Yahoo, Name = "Spitzys" }); //Leagues.Add( new RosterGridLeague //{ // Id = Constants.K_LEAGUE_Rants_n_Raves, // Name = "NFL.com" //} ); }
public DataSet LoadProjectedData( ArrayList plyrList, IRatePlayers scorer, IWeekMaster weekMaster) { var ds = new DataSet(); var dt = new DataTable(); var cols = dt.Columns; cols.Add("Name", typeof(String)); cols.Add("Pos", typeof(String)); cols.Add("Role", typeof(String)); cols.Add("RookieYr", typeof(String)); cols.Add("Age", typeof(String)); cols.Add("Currteam", typeof(String)); if (ShowOpponent) { cols.Add("Opponent", typeof(String)); cols.Add("Spread", typeof(String)); cols.Add("OppRate", typeof(String)); } cols.Add("FT", typeof(String)); if (LongStats) { cols.Add("CurScores", typeof(Int32)); cols.Add("Scores", typeof(Int32)); cols.Add("Avg", typeof(Decimal)); cols.Add("Injury", typeof(Int32)); cols.Add("Tdp", typeof(Int32)); cols.Add("YDp", typeof(Int32)); cols.Add("Tdr", typeof(Int32)); cols.Add("TDc", typeof(Int32)); cols.Add("YDr", typeof(Int32)); cols.Add("YDc", typeof(Int32)); cols.Add("Fg", typeof(Int32)); cols.Add("Health", typeof(Decimal)); cols.Add("AdjProj", typeof(Int32)); } cols.Add("Points", typeof(Decimal)); cols.Add("PFP", typeof(Int32)); cols.Add("Adp", typeof(Int32)); if (Season == null) { Season = Utility.CurrentSeason(); } var dao = new DbfPlayerGameMetricsDao(); foreach (NFLPlayer p in plyrList) { var pgms = dao.GetSeason(Season, p.PlayerCode); var totPoints = 0M; foreach (PlayerGameMetrics pgm in pgms) { var theWeek = weekMaster.GetWeek(Season, Int32.Parse(pgm.Week())); // if there is no scorer it just reads the stats, this is what we want if (scorer == null) { p.Points = pgm.CalculateProjectedFantasyPoints(p); } else { scorer.RatePlayer(p, theWeek); } if (p.TotStats == null) { p.TotStats = new PlayerStats(); } p.TotStats.Tdp += pgm.ProjTDp; p.TotStats.YDp += pgm.ProjYDp; p.TotStats.Tdr += pgm.ProjTDr; p.TotStats.Tdc += pgm.ProjTDc; p.TotStats.YDr += pgm.ProjYDr; p.TotStats.YDc += pgm.ProjYDc; p.TotStats.Fg += pgm.ProjFG; totPoints += p.Points; } if (totPoints > 0 || !SupressZeros) { var dr = dt.NewRow(); dr["Name"] = p.PlayerName; dr["Pos"] = p.PlayerPos; dr["Role"] = p.RoleOut(); dr["RookieYr"] = p.RookieYear; dr["CurrTeam"] = p.TeamCode; if (ShowOpponent) { dr["Opponent"] = p.Opponent; dr["Spread"] = p.PlayerSpread; dr["OppRate"] = p.OppRate; } if (p.Owner == null) { p.LoadOwner(); } dr["FT"] = p.Owner; dr["Age"] = p.PlayerAge(); if (LongStats) { dr["CurSCORES"] = p.CurrScores; dr["SCORES"] = p.Scores; dr["Avg"] = p.ScoresPerYear(); dr["INJURY"] = p.Injuries(); dr["Tdp"] = p.TotStats.Tdp; dr["YDp"] = p.TotStats.YDp; dr["Tdr"] = p.TotStats.Tdr; dr["TDc"] = p.TotStats.Tdc; dr["YDr"] = p.TotStats.YDr; dr["YDc"] = p.TotStats.YDc; dr["Fg"] = p.TotStats.Fg; dr["Health"] = p.HealthRating(); dr["AdjProj"] = p.HealthRating() * totPoints; } dr["Points"] = totPoints; dr["PFP"] = p.Rating; dr["Adp"] = p.Adp; dt.Rows.Add(dr); //Logger.Info( $"{p.PlayerName:-20} {totPoints:0.0}" ); } } ds.Tables.Add(dt); return(ds); }
public void TestScoringOnARunningBack() { var sut = new YahooProjectionScorer(); var w = new NFLWeek( "2014", "14" ); var p = new NFLPlayer( "BERNGI01" ); var gameKey = p.GameKeyFor( "2014", "14" ); // plyr needs their projections loaded too var dao = new DbfPlayerGameMetricsDao(); // Could use a Fake here var pgm = dao.GetPlayerWeek( gameKey, p.PlayerCode ); p.LoadProjections( pgm ); var score = sut.RatePlayer( p, w ); Assert.AreEqual( 12.0M, score ); }
public DataSet LoadProjectedData( ArrayList plyrList, IRatePlayers scorer, IWeekMaster weekMaster, IAdpMaster adpMaster = null) { var ds = new DataSet(); var dt = new DataTable(); DefineReportColumns(dt); if (Season == null) { Season = Utility.CurrentSeason(); } var dao = new DbfPlayerGameMetricsDao(); foreach (NFLPlayer p in plyrList) { if (p.PlayerName.Equals("Mark Ingram")) { Console.WriteLine("TestPlayer check"); } var pgms = dao.GetSeason(Season, p.PlayerCode); var totPoints = 0M; foreach (PlayerGameMetrics pgm in pgms) { var nWeek = Int32.Parse(pgm.Week()); var theWeek = weekMaster.GetWeek( season: Season, week: nWeek); // We are only concerned with the first 4 weeks //if (nWeek > 4) // continue; // if there is no scorer it just reads the stats, // this is what we want if (scorer == null) { p.Points = pgm.CalculateProjectedFantasyPoints(p); } else { scorer.RatePlayer(p, theWeek); } if (p.TotStats == null) { p.TotStats = new PlayerStats(); } p.TotStats.Tdp += pgm.ProjTDp; p.TotStats.YDp += pgm.ProjYDp; p.TotStats.Tdr += pgm.ProjTDr; p.TotStats.Tdc += pgm.ProjTDc; p.TotStats.YDr += pgm.ProjYDr; p.TotStats.YDc += pgm.ProjYDc; p.TotStats.Fg += pgm.ProjFG; totPoints += p.Points; } if (totPoints > 0 || !SupressZeros) { var dr = dt.NewRow(); dr["Name"] = p.ProjectionLink(Season); dr["Pos"] = p.PlayerPos; dr["Role"] = p.RoleOut(); dr["RookieYr"] = p.RookieYear; dr["CurrTeam"] = p.TeamCode; if (ShowOpponent) { dr["Opponent"] = p.Opponent; dr["Spread"] = p.PlayerSpread; dr["OppRate"] = p.OppRate; } if (p.Owner == null) { p.LoadOwner(); } dr["FT"] = p.Owner; dr["Age"] = p.PlayerAge(); if (LongStats) { dr["cat"] = p.PlayerCat; dr["scoremod"] = p.ScoreModifier(); dr["seasons"] = p.NoOfSeasons(); dr["newteam"] = p.IsNewbie() ? "*" : string.Empty; dr["CurSCORES"] = p.CurrScores; dr["SCORES"] = p.Scores; dr["Avg"] = p.ScoresPerYear(); dr["INJURY"] = p.Injuries(); dr["Tdp"] = p.TotStats.Tdp; dr["YDp"] = p.TotStats.YDp; dr["Tdr"] = p.TotStats.Tdr; dr["TDc"] = p.TotStats.Tdc; dr["YDr"] = p.TotStats.YDr; dr["YDc"] = p.TotStats.YDc; dr["Fg"] = p.TotStats.Fg; dr["Health"] = p.HealthRating(); dr["newbie"] = 1.0M - p.NewbieModifier(); dr["adjProj"] = AdjustedPoints( p, totPoints); dr["AgeRate"] = p.AgeRating(); } dr["Points"] = totPoints; if (!LongStats) { dr["Points"] = (int)AdjustedPoints( p, totPoints); } dr["Adp"] = AsDraftRound(p.Adp); if (adpMaster != null) { dr["Adp"] = adpMaster.GetAdp( p.PlayerName); } dt.Rows.Add(dr); //Logger.Trace($"{p.PlayerName:-20} {totPoints:0.0}"); } } ds.Tables.Add(dt); return(ds); }
private decimal PointsFor( NFLPlayer plyr, int increment, string forScoreType, string id ) { // nScores could be TDs, FGs or PATs decimal nScores = 0M; if (Week.HasPassed()) { var ds = plyr.LastScores(forScoreType, Week.WeekNo, Week.WeekNo, Week.Season, id); nScores = ds.Tables[0].Rows.Count; } else { var dao = new DbfPlayerGameMetricsDao(); var gameCode = Week.GameCodeFor(plyr.TeamCode); if (!string.IsNullOrEmpty(gameCode)) { var pgm = dao.GetPlayerWeek(gameCode, plyr.PlayerCode); nScores = pgm.ProjectedScoresOfType(forScoreType, id); } } decimal points = nScores * increment; switch (forScoreType) { case Constants.K_SCORE_TD_PASS: if (plyr.PlayerCat.Equals(Constants.K_QUARTERBACK_CAT) && (id == "2")) { plyr.ProjectedTDp = nScores; PointsLine( "Tdp", plyr.PlayerNameShort, points ); } else { plyr.ProjectedTDc = nScores; PointsLine( "TDc", plyr.PlayerNameShort, points ); } break; case Constants.K_SCORE_TD_RUN: PointsLine( "Tdr", plyr.PlayerNameShort, points ); plyr.ProjectedTDr = nScores; break; case Constants.K_SCORE_FIELD_GOAL: PointsLine( "FG ", plyr.PlayerNameShort, points ); plyr.ProjectedFg = (int) nScores; break; case Constants.K_SCORE_PAT: break; default: Utility.Announce(string.Format("GS4Scorer: Unknown score type {0}", forScoreType)); break; } #if DEBUG Utility.Announce( string.Format( "{0} gets {1} for score type {2}", plyr.PlayerNameShort, points, Utility.ScoreTypeOut(forScoreType) ) ); #endif return points; }
public DataSet LoadProjectedData( ArrayList plyrList, IRatePlayers scorer, IWeekMaster weekMaster ) { var ds = new DataSet(); var dt = new DataTable(); var cols = dt.Columns; cols.Add("Name", typeof (String)); cols.Add("Pos", typeof (String)); cols.Add("Role", typeof (String)); cols.Add("RookieYr", typeof (String)); cols.Add("Age", typeof (String)); cols.Add("Currteam", typeof (String)); if (ShowOpponent) { cols.Add("Opponent", typeof(String)); cols.Add("Spread", typeof(String)); cols.Add("OppRate", typeof(String)); } cols.Add("FT", typeof (String)); if (LongStats) { cols.Add("CurScores", typeof (Int32)); cols.Add("Scores", typeof (Int32)); cols.Add("Avg", typeof (Decimal)); cols.Add("Injury", typeof (Int32)); cols.Add("Tdp", typeof (Int32)); cols.Add("YDp", typeof (Int32)); cols.Add("Tdr", typeof (Int32)); cols.Add("TDc", typeof (Int32)); cols.Add("YDr", typeof (Int32)); cols.Add("YDc", typeof (Int32)); cols.Add("Fg", typeof (Int32)); cols.Add( "Health", typeof( Decimal ) ); cols.Add( "AdjProj", typeof( Int32 ) ); } cols.Add("Points", typeof (Decimal)); if (Season == null) Season = Utility.CurrentSeason(); var dao = new DbfPlayerGameMetricsDao(); foreach (NFLPlayer p in plyrList) { var pgms = dao.GetSeason(Season, p.PlayerCode); var totPoints = 0M; foreach (PlayerGameMetrics pgm in pgms) { var theWeek = weekMaster.GetWeek( Season, Int32.Parse( pgm.Week() ) ); // if there is no scorer it just reads the stats, this is what we want if ( scorer == null ) p.Points = pgm.CalculateProjectedFantasyPoints(p); else scorer.RatePlayer( p, theWeek ); if ( p.TotStats == null) p.TotStats = new PlayerStats(); p.TotStats.Tdp += pgm.ProjTDp; p.TotStats.YDp += pgm.ProjYDp; p.TotStats.Tdr += pgm.ProjTDr; p.TotStats.Tdc += pgm.ProjTDc; p.TotStats.YDr += pgm.ProjYDr; p.TotStats.YDc += pgm.ProjYDc; p.TotStats.Fg += pgm.ProjFG; totPoints += p.Points; } if (totPoints > 0 || !SupressZeros) { var dr = dt.NewRow(); dr["Name"] = p.PlayerName; dr["Pos"] = p.PlayerPos; dr["Role"] = p.RoleOut(); dr["RookieYr"] = p.RookieYear; dr["CurrTeam"] = p.TeamCode; if (ShowOpponent) { dr["Opponent"] = p.Opponent; dr["Spread"] = p.PlayerSpread; dr["OppRate"] = p.OppRate; } if (p.Owner == null) p.LoadOwner(); dr["FT"] = p.Owner; dr["Age"] = p.PlayerAge(); if (LongStats) { dr["CurSCORES"] = p.CurrScores; dr["SCORES"] = p.Scores; dr["Avg"] = p.ScoresPerYear(); dr["INJURY"] = p.Injuries(); dr["Tdp"] = p.TotStats.Tdp; dr["YDp"] = p.TotStats.YDp; dr["Tdr"] = p.TotStats.Tdr; dr["TDc"] = p.TotStats.Tdc; dr["YDr"] = p.TotStats.YDr; dr["YDc"] = p.TotStats.YDc; dr["Fg"] = p.TotStats.Fg; dr[ "Health" ] = p.HealthRating(); dr[ "AdjProj" ] = p.HealthRating()*totPoints; } dr["Points"] = totPoints; dt.Rows.Add(dr); } } ds.Tables.Add(dt); return ds; }
private decimal PointsFor( NFLPlayer plyr, int increment, string forScoreType, string id ) { decimal nScores; var ds = new DataSet(); if ( WeekHasPassed ) { ds = plyr.LastScores( forScoreType, Week.WeekNo, Week.WeekNo, Week.Season, id ); nScores = ds.Tables[ 0 ].Rows.Count; if (forScoreType == Constants.K_SCORE_TD_PASS && id == "1") forScoreType = Constants.K_SCORE_TD_CATCH; plyr.AddMetric( forScoreType, GameKey, nScores ); } else { // use projections var dao = new DbfPlayerGameMetricsDao(); var pgm = dao.GetPlayerWeek( GameKey, plyr.PlayerCode ); nScores = pgm.ProjectedScoresOfType( forScoreType, id ); } var points = nScores * increment; switch ( forScoreType ) { case Constants.K_SCORE_TD_PASS: if ( plyr.PlayerCat.Equals( Constants.K_QUARTERBACK_CAT ) && ( id == "2" ) ) plyr.ProjectedTDp = nScores; else plyr.ProjectedTDc = nScores; break; case Constants.K_SCORE_TD_RUN: plyr.ProjectedTDr = nScores; break; case Constants.K_SCORE_FIELD_GOAL: plyr.ProjectedFg = (int) nScores; if ( WeekHasPassed ) points = ScoreFG( table: ds.Tables[ 0 ] ); break; case Constants.K_SCORE_PAT_PASS: break; case Constants.K_SCORE_PAT: break; case Constants.K_SCORE_PAT_RUN: break; case Constants.K_SCORE_TD_CATCH: plyr.ProjectedTDc = nScores; break; default: Utility.Announce( string.Format( "YahooScorer: Unknown score type {0}", forScoreType ) ); break; } return points; }
public void TestRenderTommysProjection() { var dao = new DbfPlayerGameMetricsDao(); // Could use a Fake here var scorer = new YahooProjectionScorer(); // Could use a Fake here var sut = new FantasyProjectionReport("2013", "4", dao, scorer) { League = Constants.K_LEAGUE_50_Dollar_Challenge }; sut.RenderAll(); Assert.IsTrue(File.Exists(sut.FileName())); }
public void LoadLineups() { if (PgmDao == null) PgmDao = new DbfPlayerGameMetricsDao(); LoadHomeLineup(); LoadAwayLineup(); }
public PlayerGameMetrics GetPgmFor( string playerCode ) { if ( PgmDao == null ) PgmDao = new DbfPlayerGameMetricsDao(); return PgmDao.Get( playerCode, GameKey() ); }
public void TestRenderSingleLeagueRunningbacksProjection() { // shorter test 7 mins just on running backs var dao = new DbfPlayerGameMetricsDao(); // Could use a Fake here var scorer = new YahooProjectionScorer(); // Could use a Fake here var sut = new FantasyProjectionReport("2014", "14", dao, scorer) { League = Constants.K_LEAGUE_Yahoo}; sut.RenderRunningbacks(); var fileOut = sut.FileName(); Assert.IsTrue(File.Exists(fileOut)); }
private string PlayerProjectionsHtml(NflTeam nflTeam) { var html = HtmlLib.H4(nflTeam.NameOut()) + Environment.NewLine; html += HtmlLib.TableWithBorderOpen(); if (nflTeam.PlayerList.Count == 0) nflTeam.LoadPlayerUnits(); if (PgmDao == null) PgmDao = new DbfPlayerGameMetricsDao(); if (GameWeek == null) GameWeek = new NFLWeek( Season, Week ); var scorer = new YahooProjectionScorer(); var nPlayers = 0; var nTotPts = 0.0M; var totPgm = new PlayerGameMetrics(); foreach (NFLPlayer p in nflTeam.PlayerList) { if (!p.IsFantasyOffence()) continue; nPlayers++; var pgm = PgmDao.Get(p.PlayerCode, GameKey()); if (nPlayers == 1) html += pgm.PgmHeaderRow(); if (!pgm.HasNumbers()) continue; SetProjectedStats( p, pgm ); var fpts = scorer.RatePlayer( p, GameWeek ); nTotPts += fpts; html += HtmlLib.Para(pgm.FormatAsTableRow(p.PlayerName, p.PlayerRole, fpts)) + Environment.NewLine; totPgm.ProjYDp += pgm.ProjYDp; totPgm.ProjTDp += pgm.ProjTDp; totPgm.ProjYDr += pgm.ProjYDr; totPgm.ProjTDr += pgm.ProjTDr; totPgm.ProjYDc += pgm.ProjYDc; totPgm.ProjTDc += pgm.ProjTDc; totPgm.ProjFG += pgm.ProjFG; totPgm.ProjPat += pgm.ProjPat; } html += HtmlLib.Para(totPgm.FormatAsTableRow("Totals", "", nTotPts)) + Environment.NewLine; html += HtmlLib.TableClose(); return html; }
public void TestGetPlayerProjections() { var sut = new DbfPlayerGameMetricsDao(); var pgms = sut.GetSeason( "2014", "KAEPCO01" ); Assert.IsTrue(pgms.Count > 0 ); }