public decimal SpreadRecordAfterWin(DateTime since) { var dt = Utility.TflWs.GetAllGamesDt(TeamCode); var winsAfterWin = 0.0M; var lossesAfterWin = 0.0M; var lastResultWasWin = false; foreach (DataRow dr in dt.Rows) { if (DateTime.Parse(dr["GameDate"].ToString()) <= since) continue; var game = new NFLGame(dr); if (lastResultWasWin) { if (game.WonVsSpread(this)) winsAfterWin++; else lossesAfterWin++; } lastResultWasWin = game.Won(this); // outright win } var totGames = winsAfterWin + lossesAfterWin; if (totGames == 0.0M) return 0.0M; return (winsAfterWin / totGames); }
public decimal SpreadRecordAfterLoss(DateTime since) { var dt = Utility.TflWs.GetAllGamesDt(TeamCode); var winsAfterLoss = 0.0M; var lossesAfterLoss = 0.0M; var spreadRecord = 0.0M; var lastResultWasLoss = false; foreach (DataRow dr in dt.Rows) { if (DateTime.Parse(dr["GameDate"].ToString()) <= since) continue; NFLGame game = new NFLGame(dr); if (lastResultWasLoss) { if (game.WonVsSpread(this)) winsAfterLoss++; else lossesAfterLoss++; } lastResultWasLoss = game.Lost(this); // outright loss } if (winsAfterLoss + lossesAfterLoss > 0) spreadRecord = winsAfterLoss / (winsAfterLoss + lossesAfterLoss); return spreadRecord; }