Exemple #1
0
        public override async ValueTask Process(MatchesContext matchesContext)
        {
            List <Match> total = await matchesContext.GetMatchesByRoleAsync(Role).ToListAsync();

            IAsyncEnumerable <(Match Match, int Change)> wins = matchesContext.GetMatchesByOutcomeAsync(total.ToAsyncEnumerable(), Outcome.Win);

            double sumWins = await wins.CountAsync();

            double sumTotal = total.Count;

            double winRate           = sumWins / sumTotal;
            double percentageWinRate = winRate * 100d;

            Console.WriteLine($"Winrate for {Role} is: {percentageWinRate:0.00}%");
        }
Exemple #2
0
        public override async ValueTask Process(MatchesContext matchesContext)
        {
            IAsyncEnumerable <Match> matches = matchesContext.GetMatchesByRoleAsync(Role);

            if (!await matches.AnyAsync())
            {
                Console.WriteLine("No historic match data.");
            }
            else
            {
                using IXLWorkbook workbook = ConstructSpreadsheet(await matches.ToListAsync());

                string filePath = Path.GetFullPath($"{Name}_{Role}.xlsx");
                workbook.SaveAs(filePath);
                Console.WriteLine($"Successfully exported match data to \"{filePath}\"");
            }
        }