public bool FindMatchingMaps(MapStatisticModel MapA, string PeriodName, TeamStatisticPeriodModel TeamB) { bool MapFound = false; foreach (var period in TeamB.TeamStatistics) { // Find matching period if (PeriodName == period.Period) { // Try to find matching map foreach (var MapB in period.Maps) { if (MapA.Map.ToLower() == MapB.Map.ToLower()) { MapFound = true; // If found compare maps MapA.SuggestedMap = CompareStats(MapA, MapB); } } if (MapFound == false) { // Compare with empty map MapA.SuggestedMap = CompareStats(MapA, new MapStatisticModel()); } } } return(true); }
public async Task <TeamStatisticPeriodModel> GetTeamPeriodStatistics(int TeamId, List <string> PeriodSelection, ExpectedLineUp expectedLinup, int secondaryTeamId, bool NoCache, int MinFullTeamRanking, string teamRank, string logo, int?ignoreTeamId = null) { var result = new TeamStatisticPeriodModel(); result.TeamId = TeamId; result.TeamName = GetTeamName(TeamId); result.TeamDifficultyRating = _program.GetRankingValueForTeam(TeamId, DateTime.Now); result.TeamRank = teamRank; result.Logo = logo; foreach (var period in PeriodSelection) { await Task.Run(() => result.TeamStatistics.Add(GetTeamPeriodStatistics(TeamId, (PeriodEnum)int.Parse(period), expectedLinup, secondaryTeamId, NoCache, MinFullTeamRanking, ignoreTeamId))).ConfigureAwait(false); } return(result); }