Add grouping for servers on top stats, live radar, and scoreboard
This commit is contained in:
@ -16,7 +16,6 @@ using System.Threading.Tasks;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using ILogger = Microsoft.Extensions.Logging.ILogger;
|
||||
using Data.Abstractions;
|
||||
using IW4MAdmin.Plugins.Stats.Config;
|
||||
using Stats.Config;
|
||||
|
||||
namespace IW4MAdmin.Plugins.Web.StatsWeb.Controllers
|
||||
@ -70,7 +69,8 @@ namespace IW4MAdmin.Plugins.Web.StatsWeb.Controllers
|
||||
{
|
||||
Name = selectedServer.Hostname,
|
||||
IPAddress = selectedServer.ListenAddress,
|
||||
Port = selectedServer.ListenPort
|
||||
Port = selectedServer.ListenPort,
|
||||
Game = selectedServer.GameCode
|
||||
}));
|
||||
}
|
||||
|
||||
|
@ -61,15 +61,16 @@ namespace WebfrontCore.Controllers
|
||||
public ActionResult Scoreboard(string serverId)
|
||||
{
|
||||
ViewBag.Title = Localization["WEBFRONT_TITLE_SCOREBOARD"];
|
||||
ViewBag.SelectedServerId = string.IsNullOrEmpty(serverId) ? Manager.GetServers().FirstOrDefault()?.ToString() : serverId;
|
||||
|
||||
ViewBag.SelectedServerId = string.IsNullOrEmpty(serverId)
|
||||
? Manager.GetServers().FirstOrDefault()?.ToString()
|
||||
: serverId;
|
||||
|
||||
return View(ProjectScoreboard(Manager.GetServers(), null, true));
|
||||
}
|
||||
|
||||
[HttpGet("[controller]/{id}/scoreboard")]
|
||||
public ActionResult Scoreboard(string id, [FromQuery]string order = null, [FromQuery] bool down = true)
|
||||
public ActionResult Scoreboard(string id, [FromQuery] string order = null, [FromQuery] bool down = true)
|
||||
{
|
||||
|
||||
var server = Manager.GetServers().FirstOrDefault(srv => srv.ToString() == id);
|
||||
|
||||
if (server == null)
|
||||
@ -78,19 +79,20 @@ namespace WebfrontCore.Controllers
|
||||
}
|
||||
|
||||
ViewBag.SelectedServerId = id;
|
||||
return View("_Scoreboard", ProjectScoreboard(new[] {server}, order, down).First());
|
||||
return View("_Scoreboard", ProjectScoreboard(new[] { server }, order, down).First());
|
||||
}
|
||||
|
||||
private static IEnumerable<ScoreboardInfo> ProjectScoreboard(IEnumerable<Server> servers, string order,
|
||||
bool down)
|
||||
{
|
||||
return servers.Select((server, index) => new ScoreboardInfo
|
||||
return servers.Select(server => new ScoreboardInfo
|
||||
{
|
||||
OrderByKey = order,
|
||||
ShouldOrderDescending = down,
|
||||
MapName = server.CurrentMap.ToString(),
|
||||
ServerName = server.Hostname,
|
||||
ServerId = server.ToString(),
|
||||
GameCode = server.GameCode,
|
||||
ClientInfo = server.GetClientsAsList().Select(client =>
|
||||
new
|
||||
{
|
||||
@ -107,7 +109,9 @@ namespace WebfrontCore.Controllers
|
||||
Deaths = clientData.stats?.MatchData?.Deaths,
|
||||
ScorePerMinute = clientData.stats?.SessionSPM,
|
||||
Kdr = clientData.stats?.MatchData?.Kdr,
|
||||
ZScore = clientData.stats?.ZScore == null || clientData.stats.ZScore == 0 ? null : clientData.stats.ZScore,
|
||||
ZScore = clientData.stats?.ZScore == null || clientData.stats.ZScore == 0
|
||||
? null
|
||||
: clientData.stats.ZScore,
|
||||
Team = clientData.client.Team
|
||||
})
|
||||
.ToList()
|
||||
|
Reference in New Issue
Block a user