1
0
mirror of https://github.com/RaidMax/IW4M-Admin.git synced 2025-06-10 15:20:48 -05:00

fix refactor issue

This commit is contained in:
RaidMax
2022-01-28 17:28:49 -06:00
parent 75d6417d64
commit bac343cdba
10 changed files with 44 additions and 47 deletions

View File

@ -3,18 +3,17 @@ using System.Threading.Tasks;
using IW4MAdmin.Plugins.Stats;
using IW4MAdmin.Plugins.Stats.Helpers;
using Microsoft.AspNetCore.Mvc;
using SharedLibraryCore.Interfaces;
using Stats.Config;
namespace WebfrontCore.ViewComponents
{
public class TopPlayersViewComponent : ViewComponent
{
private readonly IConfigurationHandler<StatsConfiguration> _configurationHandler;
private readonly StatsConfiguration _config;
public TopPlayersViewComponent(IConfigurationHandler<StatsConfiguration> configurationHandler)
public TopPlayersViewComponent(StatsConfiguration config)
{
_configurationHandler = configurationHandler;
_config = config;
}
public async Task<IViewComponentResult> InvokeAsync(int count, int offset, long? serverId = null)
@ -32,7 +31,7 @@ namespace WebfrontCore.ViewComponents
}
ViewBag.UseNewStats = _configurationHandler.Configuration()?.EnableAdvancedMetrics ?? true;
ViewBag.UseNewStats = _config?.EnableAdvancedMetrics ?? true;
return View("~/Views/Client/Statistics/Components/TopPlayers/_List.cshtml",
ViewBag.UseNewStats
? await Plugin.Manager.GetNewTopStats(offset, count, serverId)