BrokenShoeLeague.Domain.Utils.CalculatePerformance C# (CSharp) Method

CalculatePerformance() public static method

public static CalculatePerformance ( IEnumerable stats ) : double
stats IEnumerable
return double
        public static double CalculatePerformance(IEnumerable<PlayerRecord> stats)
        {
            int jj = 0, jg = 0, je = 0, jp = 0, assists = 0, goals = 0, ag = 0;
            foreach (var stat in stats)
            {
                jj += stat.PlayedGames;
                jg += stat.Won;
                jp += stat.Lost;
                je += stat.Tied;
                assists += stat.Assists;
                goals += stat.Goals;
                ag += stat.AllowedGoals;
            }

            return CalculatePerformance(jj, jg, jp, je, assists, goals, ag);
        }

Same methods

Utils::CalculatePerformance ( Player player ) : double
Utils::CalculatePerformance ( PlayerRecord pRecord ) : double
Utils::CalculatePerformance ( int jj, int jg, int jp, int je, int assists, int goals, int ag, int jjp ) : double

Usage Example

Example #1
0
 public double CalculatePerformance(int seasonId = 0)
 {
     return(Utils.CalculatePerformance(seasonId <= 0 ? PlayerRecords : PlayerRecords.Where(x => x.Matchday.Season.Id == seasonId)));
 }