public ActionResult Forecast(ForecastViewModel vm) { vm.AvailablePlayers = getAvailablePlayersSelectListItems(); var playerA = _userService.GetUser(vm.PlayerAId); var playerB = _userService.GetUser(vm.PlayerBId); vm.NamePlayerA = playerA.Name; vm.NamePlayerB = playerB.Name; vm.CurrentRatingPlayerA = (double)_statsService.GetUserStat(playerA.Id).Elo; vm.CurrentRatingPlayerB = (double)_statsService.GetUserStat(playerB.Id).Elo; var elo = new EloCalculator(vm.CurrentRatingPlayerA, vm.CurrentRatingPlayerB); vm.ChanceToWinPlayerA = elo.GetChanceToWinPlayerA() * 100; vm.ChanceToWinPlayerB = 100 - vm.ChanceToWinPlayerA; elo.WinGamePlayerA(); vm.RatingPlayerAWinPlayerA = elo.RatingPlayerA; vm.RatingPlayerBWinPlayerA = elo.RatingPlayerB; elo = new EloCalculator(vm.CurrentRatingPlayerA, vm.CurrentRatingPlayerB); elo.WinGamePlayerB(); vm.RatingPlayerAWinPlayerB = elo.RatingPlayerA; vm.RatingPlayerBWinPlayerB = elo.RatingPlayerB; elo = new EloCalculator(vm.CurrentRatingPlayerA, vm.CurrentRatingPlayerB); elo.DrawGame(); vm.RatingPlayerADrawGame = elo.RatingPlayerA; vm.RatingPlayerBDrawGame = elo.RatingPlayerB; vm.Calculated = true; return(View(vm)); }
public ActionResult Forecast(ForecastViewModel vm) { vm.AvailablePlayers = getAvailablePlayersSelectListItems(); var playerA = _userService.GetUser(vm.PlayerAId); var playerB = _userService.GetUser(vm.PlayerBId); vm.NamePlayerA = playerA.Name; vm.NamePlayerB = playerB.Name; vm.CurrentRatingPlayerA = (double)_statsService.GetUserStat(playerA.Id).Elo; vm.CurrentRatingPlayerB = (double)_statsService.GetUserStat(playerB.Id).Elo; var elo = new EloCalculator(vm.CurrentRatingPlayerA, vm.CurrentRatingPlayerB); vm.ChanceToWinPlayerA = elo.GetChanceToWinPlayerA() * 100; vm.ChanceToWinPlayerB = 100 - vm.ChanceToWinPlayerA; elo.WinGamePlayerA(); vm.RatingPlayerAWinPlayerA = elo.RatingPlayerA; vm.RatingPlayerBWinPlayerA = elo.RatingPlayerB; elo = new EloCalculator(vm.CurrentRatingPlayerA, vm.CurrentRatingPlayerB); elo.WinGamePlayerB(); vm.RatingPlayerAWinPlayerB = elo.RatingPlayerA; vm.RatingPlayerBWinPlayerB = elo.RatingPlayerB; elo = new EloCalculator(vm.CurrentRatingPlayerA, vm.CurrentRatingPlayerB); elo.DrawGame(); vm.RatingPlayerADrawGame = elo.RatingPlayerA; vm.RatingPlayerBDrawGame = elo.RatingPlayerB; vm.Calculated = true; return View(vm); }