/// <summary> /// Builds player statistic /// </summary> /// <param name="handHistory"></param> /// <param name="player"></param> private Playerstatistic BuildPlayerStatistic(PlayerStatisticCreationInfo playerStatisticCreationInfo) { var playerStatisticCalculator = ServiceLocator.Current.GetInstance <IPlayerStatisticCalculator>(playerStatisticCreationInfo.GetServiceName()); var playerStat = playerStatisticCalculator.CalculateStatistic(playerStatisticCreationInfo); return(playerStat); }
/// <summary> /// Builds player statistic /// </summary> /// <param name="handHistory"></param> /// <param name="player"></param> private void BuildPlayerStatistic(Handhistory dbHandHistory, PlayerStatisticCreationInfo playerStatisticCreationInfo) { try { var playerStatisticCalculator = ServiceLocator.Current.GetInstance <IPlayerStatisticCalculator>(playerStatisticCreationInfo.GetServiceName()); var statistic = playerStatisticCalculator.CalculateStatistic(playerStatisticCreationInfo); if (!string.IsNullOrEmpty(dbHandHistory.Tourneynumber)) { statistic.IsTourney = true; statistic.TournamentId = dbHandHistory.Tourneynumber; } StorePlayerStatistic(statistic); } catch (Exception e) { LogProvider.Log.Error(this, $"Failed to process hand #{dbHandHistory.Gamenumber}, player {playerStatisticCreationInfo.Player?.Playername} .", e); throw new DHInternalException(new NonLocalizableString($"Failed to rebuild stats of hand #{dbHandHistory.Gamenumber}")); } }