Esempio n. 1
0
        public async Task <ActionResult <DsResponse> > GetMvp(DsRequest request)
        {
            Stopwatch sw = new Stopwatch();

            sw.Start();
            DsResponse response;

            if (request.Filter == null || request.Filter.isDefault)
            {
                // response = await WinrateService.GetWinrateFromTimeResults(context, request);
                response = StatsService.GetMvp(request, await GetCmdrStats(request.Player));
            }
            else
            {
                // response = await WinrateService.GetWinrate(context, request);
                response = await StatsService.GetCustomMvp(request, context);
            }
            await SetLeaverQuit(request, response);

            sw.Stop();
            logger.LogInformation($"Get Mvp in {sw.ElapsedMilliseconds} ms");
            return(response);
        }
Esempio n. 2
0
        public async Task <DsResponse> LoadData(DsRequest request)
        {
            DsResponse response;

            if (request.Filter == null || request.Filter.isDefault)
            {
                response = request.Mode switch
                {
                    "Winrate" => StatsService.GetWinrate(request, await GetStats(request.Player)),
                    "Timeline" => StatsService.GetTimeline(new TimelineRequest(request.Mode, request.Timespan, request.Player, request.Interest, request.Versus)
                                                           , await GetStats(request.Player)),
                    "MVP" => request.Player ? await StatsService.GetCustomMvp(request, context) : StatsService.GetMvp(request, await GetStats(request.Player)),
                    "DPS" => StatsService.GetDps(request, await GetStats(request.Player)),
                    "Synergy" => await StatsService.GetSynergy(context, request),
                    "AntiSynergy" => await StatsService.GetAntiSynergy(context, request),
                    "Duration" => await StatsService.GetDuration(context, request),
                    "Standard" => await StatsService.GetStandardTeamWinrate(request, context),
                    _ => StatsService.GetWinrate(request, await GetStats(request.Player))
                };
            }
            else
            {
                response = request.Mode switch
                {
                    "Winrate" => await StatsService.GetCustomWinrate(request, context),
                    "Timeline" => await StatsService.GetCustomTimeline(context, new TimelineRequest(request.Mode, request.Timespan, request.Player, request.Interest, request.Versus)),
                    "MVP" => await StatsService.GetCustomMvp(request, context),
                    "DPS" => await StatsService.GetCustomDps(request, context),
                    "Synergy" => await StatsService.GetSynergy(context, request),
                    "AntiSynergy" => await StatsService.GetAntiSynergy(context, request),
                    "Duration" => await StatsService.GetDuration(context, request),
                    "Standard" => await StatsService.GetStandardTeamWinrate(request, context),
                    _ => await StatsService.GetCustomWinrate(request, context),
                };
            }
            response.CountResponse = await GetCountResponse(request);

            return(response);
        }