public void TallyTeam( ICollection <NflTeam> teamList, string season, DateTime focusDate, string teamCode) { var team = new NflTeam(teamCode); // simple code constructor if (TimeKeeper.IsItRegularSeason()) { team.LoadGames(team.TeamCode, season); GameScope = GameScopeFromGameList( team.GameList); } else { GameScope = $@"Regular season Games { Int32.Parse(season)-1 }" ; team.LoadPreviousRegularSeasonGames( team.TeamCode, season, focusDate); } team.TallyStats(Breakdowns); teamList.Add(team); var breakdownKey = $"{team.TeamCode}-Q"; var breakdownFile = $@"{Utility.OutputDirectory()}\\{ TimeKeeper.CurrentSeason() }\\Metrics\\breakdowns\\{breakdownKey}.htm" ; Breakdowns.Dump( breakdownKey, breakdownFile); }
public void RankTeams( DateTime when, string sortColumn = "YDr") { if (ForceReRank) { Logger.Trace(" Ranking forced"); } else { if (HaveAlreadyRated(when)) { Logger.Trace( $" Have already got Ratings for {when:d}"); LoadRatings(when); return; } else { Logger.Trace(" Generating ratings for {0:d}", when); } } #if DEBUG var stopwatch = new Stopwatch(); stopwatch.Start(); #endif // what season are we in var season = TimeKeeper.CurrentSeason(when); // Get the teams for that season var teamList = new List <NflTeam>(); LoadTeams(teamList, season, when); var metricTable = LoadMetrix( teamList: teamList, when: when); Rank(metricTable, "YDr DESC", UnitRatings.UnitRating.Ro); #if !DEBUG2 Rank( metricTable: metricTable, orderBy: "YDp DESC", unitrating: UnitRatings.UnitRating.Po); Rank(metricTable, "SAKa ASC", UnitRatings.UnitRating.Pp); Rank(metricTable, "SAK DESC", UnitRatings.UnitRating.Pr); Rank(metricTable, "YDra ASC", UnitRatings.UnitRating.Rd); Rank(metricTable, "IntRatio DESC", UnitRatings.UnitRating.Pd); #endif LastDateRanked = when; DumpRatingsHt(when); UpdateMetricsWithRatings(metricTable); DumpMetricTable(metricTable, when, sortColumn); WriteRatings(metricTable, when); UpdateRatings(metricTable, season); //TODO: Update the team table? #if DEBUG Utility.StopTheWatch( stopwatch, $"Ranking teams : {when:d}"); #endif }
public void TestHowStengthOfScheduleDterminesCurrentSeason() { var sut = new TimeKeeper(null); var result = sut.CurrentSeason( new DateTime( 2016, 7, 24 ) ); Assert.AreEqual( "2016", result ); Console.WriteLine( "Season>{0}", result ); }
public override void RenderAsHtml( bool structOnly = false) { StructOnly = structOnly; NflSeason = new NflSeason( TimeKeeper.CurrentSeason(), loadGames: true, loadDivisions: false); foreach (var game in NflSeason.GameList) { if (game.Played()) { continue; } if (StructOnly) { Console.WriteLine( $"WriteProjection for {game.GameName()}"); } else { TraceIt($"Writing projections for {game}"); game.WriteProjection(); } // if ( game.WeekNo > 1 ) break // short curcuit } }
private void Initialise() { Name = "Role Assignment Report"; Lines = new List <String> { Name }; Season = TimeKeeper.CurrentSeason(DateTime.Now); Aces = new List <string>(); if (Logger == null) { Logger = LogManager.GetCurrentClassLogger(); } }
public override void RenderAsHtml() { NflSeason = new NflSeason( TimeKeeper.CurrentSeason(), loadGames: true, loadDivisions: false); foreach (var game in NflSeason.GameList) { game.WriteProjection(); #if DEBUG if (game.WeekNo > 1) { break; } #endif } }
public void TestCurrentSeasonPost() { var sut = new TimeKeeper( new FakeClock( new DateTime( 2016, 02, 15 ) ) ); // set clock to Feb-2016 Assert.AreEqual( sut.CurrentSeason(), "2015" ); }
public void TestCurrentSeason2016() { var sut = new TimeKeeper(new FakeClock(new DateTime(2016, 04, 25))); // set clock to Apr-2016 Assert.AreEqual(sut.CurrentSeason(), "2016"); }
public void TestCurrentSeason() { var sut = new TimeKeeper( new FakeClock( new DateTime( 2015, 03, 16 ) ) ); // set clock to March Assert.AreEqual( sut.CurrentSeason(), "2015" ); }
public void TestTimekeeperKnowslastweek() { var sut = new TimeKeeper(new FakeClock(new DateTime(2015, 11, 17, 12, 0, 0))); Console.WriteLine( "This week is {0}:{1}", sut.CurrentSeason(), sut.CurrentWeek()); Console.WriteLine("Last week is {0}:{1}", sut.CurrentSeason(), sut.PreviousWeek()); Assert.IsTrue(sut.PreviousWeek().Equals("10")); }