fix refactor issue
This commit is contained in:
@ -19,13 +19,12 @@ namespace WebfrontCore.Controllers
|
||||
public class ClientController : BaseController
|
||||
{
|
||||
private readonly IMetaService _metaService;
|
||||
private readonly IConfigurationHandler<StatsConfiguration> _configurationHandler;
|
||||
private readonly StatsConfiguration _config;
|
||||
|
||||
public ClientController(IManager manager, IMetaService metaService,
|
||||
IConfigurationHandler<StatsConfiguration> configurationHandler) : base(manager)
|
||||
public ClientController(IManager manager, IMetaService metaService, StatsConfiguration config) : base(manager)
|
||||
{
|
||||
_metaService = metaService;
|
||||
_configurationHandler = configurationHandler;
|
||||
_config = config;
|
||||
}
|
||||
|
||||
public async Task<IActionResult> ProfileAsync(int id, MetaType? metaFilterType)
|
||||
@ -114,7 +113,7 @@ namespace WebfrontCore.Controllers
|
||||
ViewBag.Title += " " + Localization["WEBFRONT_CLIENT_PROFILE_TITLE"];
|
||||
ViewBag.Description = $"Client information for {strippedName}";
|
||||
ViewBag.Keywords = $"IW4MAdmin, client, profile, {strippedName}";
|
||||
ViewBag.UseNewStats = _configurationHandler.Configuration()?.EnableAdvancedMetrics ?? true;
|
||||
ViewBag.UseNewStats = _config?.EnableAdvancedMetrics ?? true;
|
||||
|
||||
return View("Profile/Index", clientDto);
|
||||
}
|
||||
|
@ -16,10 +16,10 @@ namespace WebfrontCore.Controllers
|
||||
|
||||
public ClientStatisticsController(IManager manager,
|
||||
IResourceQueryHelper<StatsInfoRequest, AdvancedStatsInfo> queryHelper,
|
||||
IConfigurationHandler<DefaultSettings> configurationHandler) : base(manager)
|
||||
DefaultSettings defaultConfig) : base(manager)
|
||||
{
|
||||
_queryHelper = queryHelper;
|
||||
_defaultConfig = configurationHandler.Configuration();
|
||||
_defaultConfig = defaultConfig;
|
||||
}
|
||||
|
||||
[HttpGet("{id:int}/advanced")]
|
||||
@ -35,4 +35,4 @@ namespace WebfrontCore.Controllers
|
||||
return View("~/Views/Client/Statistics/Advanced.cshtml", hitInfo.Results.First());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -27,19 +27,18 @@ namespace IW4MAdmin.Plugins.Web.StatsWeb.Controllers
|
||||
private readonly IResourceQueryHelper<ChatSearchQuery, MessageResponse> _chatResourceQueryHelper;
|
||||
private readonly ITranslationLookup _translationLookup;
|
||||
private readonly IDatabaseContextFactory _contextFactory;
|
||||
private readonly IConfigurationHandler<StatsConfiguration> _configurationHandler;
|
||||
private readonly StatsConfiguration _config;
|
||||
|
||||
public StatsController(ILogger<StatsController> logger, IManager manager, IResourceQueryHelper<ChatSearchQuery,
|
||||
MessageResponse> resourceQueryHelper, ITranslationLookup translationLookup,
|
||||
IDatabaseContextFactory contextFactory,
|
||||
IConfigurationHandler<StatsConfiguration> configurationHandler) : base(manager)
|
||||
IDatabaseContextFactory contextFactory, StatsConfiguration config) : base(manager)
|
||||
{
|
||||
_logger = logger;
|
||||
_manager = manager;
|
||||
_chatResourceQueryHelper = resourceQueryHelper;
|
||||
_translationLookup = translationLookup;
|
||||
_contextFactory = contextFactory;
|
||||
_configurationHandler = configurationHandler;
|
||||
_config = config;
|
||||
}
|
||||
|
||||
[HttpGet]
|
||||
@ -70,7 +69,7 @@ namespace IW4MAdmin.Plugins.Web.StatsWeb.Controllers
|
||||
serverId = StatManager.GetIdForServer(server);
|
||||
}
|
||||
|
||||
var results = _configurationHandler.Configuration().EnableAdvancedMetrics
|
||||
var results = _config?.EnableAdvancedMetrics ?? true
|
||||
? await Plugin.Manager.GetNewTopStats(offset, count, serverId)
|
||||
: await Plugin.Manager.GetTopStats(offset, count, serverId);
|
||||
|
||||
@ -80,7 +79,7 @@ namespace IW4MAdmin.Plugins.Web.StatsWeb.Controllers
|
||||
return Ok();
|
||||
}
|
||||
|
||||
ViewBag.UseNewStats = _configurationHandler.Configuration().EnableAdvancedMetrics;
|
||||
ViewBag.UseNewStats = _config?.EnableAdvancedMetrics;
|
||||
return View("~/Views/Client/Statistics/Components/TopPlayers/_List.cshtml", results);
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user