mirror of
https://github.com/LBPUnion/ProjectLighthouse.git
synced 2025-06-21 06:51:27 +00:00
Rewrite gameserver slot filter system (#763)
* Initial implementation of new slot sorting and filtering system * Initial implementation of filtering for lbp3 community tab * Add support for organization on lbp3 * Add playlist and user categories * Implement unit tests for all filters Refactor more systems to use PaginationData * Fix PlayerCountFilter test * Add more unit tests and integration tests for the filter system * Fix LBP2 move filter and gameFilterType * Fix sort by likes in LBP3 category * Add sort for total plays * Remove extra whitespace and make styling more consistent * Order hearted and queued levels by primary key ID * Fix query without order warnings
This commit is contained in:
parent
de228cb242
commit
0c1e350fa3
106 changed files with 4040 additions and 1183 deletions
|
@ -3,8 +3,10 @@ using LBPUnion.ProjectLighthouse.Helpers;
|
|||
using Microsoft.AspNetCore.Authorization;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using LBPUnion.ProjectLighthouse.Extensions;
|
||||
using LBPUnion.ProjectLighthouse.Filter;
|
||||
using LBPUnion.ProjectLighthouse.Filter.Filters;
|
||||
using LBPUnion.ProjectLighthouse.Servers.GameServer.Extensions;
|
||||
using LBPUnion.ProjectLighthouse.Types.Serialization;
|
||||
using LBPUnion.ProjectLighthouse.Types.Users;
|
||||
|
||||
namespace LBPUnion.ProjectLighthouse.Servers.GameServer.Controllers;
|
||||
|
||||
|
@ -14,7 +16,6 @@ namespace LBPUnion.ProjectLighthouse.Servers.GameServer.Controllers;
|
|||
[Produces("text/plain")]
|
||||
public class StatisticsController : ControllerBase
|
||||
{
|
||||
|
||||
private readonly DatabaseContext database;
|
||||
|
||||
public StatisticsController(DatabaseContext database)
|
||||
|
@ -23,7 +24,7 @@ public class StatisticsController : ControllerBase
|
|||
}
|
||||
|
||||
[HttpGet("playersInPodCount")]
|
||||
public IActionResult PlayersInPodCount() => this.Ok(StatisticsHelper.RoomCountForPlatform(this.GetToken().Platform).ToString());
|
||||
public IActionResult PlayersInPodCount() => this.Ok(StatisticsHelper.RoomCountForPlatform(this.GetToken().Platform).ToString());
|
||||
|
||||
[HttpGet("totalPlayerCount")]
|
||||
public async Task<IActionResult> TotalPlayerCount() => this.Ok((await StatisticsHelper.RecentMatchesForGame(this.database, this.GetToken().GameVersion)).ToString());
|
||||
|
@ -32,12 +33,19 @@ public IActionResult PlayersInPodCount() => this.Ok(StatisticsHelper.RoomCountFo
|
|||
[Produces("text/xml")]
|
||||
public async Task<IActionResult> PlanetStats()
|
||||
{
|
||||
int totalSlotCount = await StatisticsHelper.SlotCountForGame(this.database, this.GetToken().GameVersion);
|
||||
int mmPicksCount = await StatisticsHelper.TeamPickCountForGame(this.database, this.GetToken().GameVersion);
|
||||
SlotQueryBuilder defaultFilter = this.GetDefaultFilters(this.GetToken());
|
||||
int totalSlotCount = await StatisticsHelper.SlotCount(this.database, defaultFilter);
|
||||
defaultFilter.AddFilter(new TeamPickFilter());
|
||||
int mmPicksCount = await StatisticsHelper.SlotCount(this.database, defaultFilter);
|
||||
|
||||
return this.Ok(new PlanetStatsResponse(totalSlotCount, mmPicksCount));
|
||||
}
|
||||
|
||||
[HttpGet("planetStats/totalLevelCount")]
|
||||
public async Task<IActionResult> TotalLevelCount() => this.Ok((await StatisticsHelper.SlotCountForGame(this.database, this.GetToken().GameVersion)).ToString());
|
||||
public async Task<IActionResult> TotalLevelCount()
|
||||
{
|
||||
SlotQueryBuilder defaultFilter = this.GetDefaultFilters(this.GetToken());
|
||||
int totalSlotCount = await StatisticsHelper.SlotCount(this.database, defaultFilter);
|
||||
return this.Ok(totalSlotCount.ToString());
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue