private IEnumerable <DeckStatsDataRecord> GetBreakDownByOpponentClass( Func <DataModel.Game, object> groupByDeck, Func <DataModel.Game, SerializableVersion> groupByVersion, Func <DataModel.Game, string> groupByOpponnetClass) { return(GamesList .GroupBy(g => new { D = groupByDeck(g), VS = groupByVersion(g), OC = groupByOpponnetClass(g) }) .Select(d => new DeckStatsDataRecord { Deck = d.Key.D, DeckVersion = d.Key.VS, Opp = d.Key.OC, Win = Math.Round((double)d.Count() / GamesList.Count() * 100).ToString(), WinPerc = (double)d.Count() / GamesList.Count() * 100, })); }
private IEnumerable <DeckStatsDataRecord> GetFirstSecondData( Func <DataModel.Game, SerializableVersion> groupByVersion, Func <DataModel.Game, string> groupByOpponnetClass) { return(GamesList .GroupBy(g => new { D = GetPropertyValue(g, GroupBy), VS = groupByVersion(g), OC = groupByOpponnetClass(g) }) .Select(d => new DeckStatsDataRecord { Deck = d.Key.D, DeckVersion = d.Key.VS, Opp = d.Key.OC, Win = d.Where(d2 => d2.OrderOfPlay == OrderOfPlay.First).Count() + "-" + d.Where(d2 => d2.OrderOfPlay == OrderOfPlay.Second).Count(), WinPerc = (double)d.Where(g => g.OrderOfPlay == OrderOfPlay.First).Count() / d.Count() * 100 })); }
private IEnumerable <DeckStatsDataRecord> GetBreakDownByDeck( Func <DataModel.Game, object> groupByDeck, Func <DataModel.Game, SerializableVersion> groupByVersion, Func <DataModel.Game, string> groupByOpponnetClass) { return(GamesList .GroupBy(g => new { D = groupByDeck(g), VS = groupByVersion(g), OC = groupByOpponnetClass(g) }) .Select(d => new DeckStatsDataRecord { Deck = d.Key.D, DeckVersion = d.Key.VS, Opp = d.Key.OC, Win = d.Where(d2 => d2.Outcome == GameOutcome.Victory).Count() + "-" + d.Where(d2 => d2.Outcome == GameOutcome.Defeat).Count(), WinPerc = (double)d.Where(g => g.Outcome == GameOutcome.Victory).Count() / d.Count() * 100, })); }